Welcome to the Creatures Wiki! Log in and join the community.

Difference between revisions of "Basic lift script"

From Creatures Wiki
Jump to navigation Jump to search
m (→‎Install Script: Reserve script at Creatures Caves, not Bibbleworld)
Line 22: Line 22:
 
==Install Script==
 
==Install Script==
  
*Make sure you reserve your [[class number]]s at [[Bibbleworld]]
+
*Make sure you [http://creaturescaves.com/dev.php?section=Reservations reserve] your [[class number]]s at [[Creatures Caves]].
  
 
  [[INST|inst]]
 
  [[INST|inst]]

Revision as of 12:08, 16 August 2014

Editnorn.png This article could be cleaned up to make it more readable.

Summary

This is a very basic lift with 2 levels and 2 call buttons.

Script contents

  • Install the lift.
  • Install the call buttons.
  • Add buttons on the lift itself, up and down.
  • When up is pressed, enum the lift, and tell it to go up. Meanwhile, the button changes to look like it's 'on'. Vice versa for down.
  • When call button 1 (1st floor) or 2 (ground floor) is pressed, enum the lift, use an ov and set it to up/down (doif ov01 0/1). Make sure not to call the script when the lift is moving.

It can be changed by removing the part with ov01 = 2 in the script.

Image file content

  • 0 - the lift
  • 1 - lift call button off
  • 2 - lift call button on
  • 3 - button on lift down/off
  • 4 - button on lift down/on
  • 5 - button on lift up/off
  • 6 - button on lift up/on

Install Script

inst
new: vhcl 3 1 11111 "tutolift" 7 0 10
attr 512
bhvr 3
cabn 0 0 100 130


  • Cabin left top right down - related to the sprite boundaries - it says where the parts of the lift are.
cabp 50
perm 30
cabw 100
elas 0
clac 0
fric 100
  • The go down button - sends activate 2 (pull for norns).
pat: butt 1 "tutolift" 3 7 10 20 1 [] 3002 0
  • 3 = Image for the button (see Summary)
  • 7 = Total number of images in sprite file
  • 10 = relx
  • 20 = rely
  • 1 = relplane
  • [] = The animation for your button when you roll your mouse over it
  • 3002 = The script execution query sent when pressed
  • 0 = The call message will be sent if you've clicked on any of the pixels of the button.
  • The go up button - sends activate 1 (push for norns).
pat: butt 2 "tutolift" 5 7 35 20 1 [] 3001 0
mvto 41787 49190
  • Here the lift is already on the 1st floor - we set this in ov01.
  • 0 = ground
  • 1 = floor 1
  • 2 = in movement
setv ov01 1
  • Now we create the lift call buttons.
  • The lift caller for the first floor:
new: simp 2 12 11111 "tutolift" 7 1 10
attr 196
bhvr 1
perm 70
accg 2
elas 0
mvto 41760 49150
setv ov00 1
  • The one for the ground floor:
new: simp 2 12 11110 "tutolift" 7 1 10
attr 196
bhvr 1
perm 70
accg 2
elas 0
mvto 41760 49400
setv ov00 0
endm

Action Scripts

  • Scripts of the lift call buttons.
scrp 2 12 11111 1
  • We enum the lift and ask it with a button to execute the script (only if it is not already at the wanted level).
enum 3 1 11111
doif ov01 ne 1 and ov01 ne 2
mesg writ targ 3011
seta va00 targ
targ ownr
pose 1
targ va00
loop
untl ov01 = 1
targ ownr
pose 0
endi
next
targ ownr
endm
scrp 2 12 11110 1
enum 3 1 11111
doif ov01 ne 0 and ov01 ne 2
mesg writ targ 3012
seta va00 targ
targ ownr
pose 1
targ va00
loop
untl ov01 = 0
targ ownr
pose 0
endi
next
targ ownr
endm
  • Here are the scripts that enable the buttons on the lift to call it up and down.
  • Down:
scrp 3 1 11111 3002
enum 3 1 11111
  • 3012 is a random number that you chose to refer to a script number - you can set it fairly high, but not too much, and be careful not to choose in-use script numbers. Please reserve script numbers at Bibbleworld. Once you've choosen the number, keep it for the action you want to be done.
mesg writ targ 3012
next
targ ownr
stop
endm
  • Up:
scrp 3 1 11111 3001
enum 3 1 11111
mesg writ targ 3011
next
targ ownr
stop
endm
  • 3012 is used here - the button sent a message to the script 3012. This means that when pressed, the button tells the lift to execute the following lines.
  • Go down.
scrp 3 1 11111 3012
doif ov01 ne 0
setv ov01 2
part 1
anim [1]
part 0
lock
gpas 4 0 0 1 
  • gpas gets any nearby creatures (agents that match the script numbers 4 0 0).
loop
setv vely 3
untl obst down < 10
wait 4
setv vely 0
setv ov01 0
dpas 0 0 0
  • dpas drops everything inside the lift when the transport is done.
part 1
pose 0
part 0
unlk
setv ov01 0
endi
stop
endm

  • Go up.
scrp 3 1 11111 3011
doif ov01 ne 1
setv ov02 2
part 2
pose 1
part 0
lock
gpas 4 0 0 1
loop
setv vely -3
untl posy < 49250
setv vely 0
setv ov01 1
dpas 0 0 0
part 2
pose 0
part 0
unlk
setv ov01 1
endi
stop
endm

Remove Script

rscr
enum 3 1 11111
kill targ
next
enum 2 12 11110
kill targ
next
enum 2 12 11111
kill targ
next

Credits

  • The guy that has been breaking his poor head for 2 days to write this script: zareb
  • People that helped him to get this script finished:
  • Edash - gave all the information needed to use messages. Without him, no script! *hugs*
  • Liam - gave comments on the script, and some more information.
  • Vinsento : the poor norn that helped zareb to test this lift. You should be grateful to this norn, that travelled out of room boundaries so many times!