Knowledgebase
Storm Palace Hosting > Storm Hosting Help Desk > Knowledgebase

Ask a question:


Move in a Path Script

Solution ;Alan's Move Person in Path script
;Set the path coordinates in the ON ALARM.
;Place the following script in a door to start the movement:
ON ENTER
{
;save_position - save my current position
save_position GLOBAL
{ savedx GLOBAL
savedy GLOBAL
POSX savedx =
POSY savedy =
} save_position DEF

;restore_position - restore saved position
restore_position GLOBAL
{ savedx GLOBAL
savedy GLOBAL
savedx savedy SETPOS
} restore_position DEF

;save_props - save currently worn props
save_props GLOBAL
{ saved_prop GLOBAL
"[ " p =
0 i =
{ p i USERPROP ITOA & " " & p =
i ++
} { i NBRUSERPROPS < } WHILE
p " ]" & saved_prop =
} save_props DEF

;restore_props - restore saved prop
restore_props GLOBAL
{ saved_prop GLOBAL
{ NAKED } { saved_prop STRTOATOM EXEC SETPROPS} "[ ]" saved_prop == IFELSE
} restore_props DEF
}

ON SELECT
{
index GLOBAL 0 index =
save_position GLOBAL save_position EXEC
0 ME SETALARM
}

ON ALARM
{
index GLOBAL
;*** Set parameters here ***
0 xoffset = ;adjust all x values if wanted
-20 yoffset = ;adjust all y values if wanted
60 delaytime = ;delay between moves. Each multiple of 60 is one second.
;*** end of parameters ***
[
;*** Place move coordinates here ***
[ 100 100 ]
[ 200 200 ]
[ 300 100 ]
;*** end of coordinates ***
] movearray =
movearray index GET DUP 0 GET x = SWAP 1 GET y =
x xoffset + y yoffset + SETPOS
;first move
{ save_props GLOBAL save_props EXEC
[ -1216551138 ] SETPROPS
} index 0 == IF
;last move
{
{ restore_props GLOBAL restore_props EXEC
restore_position GLOBAL restore_position EXEC
} delaytime ALARMEXEC
} index movearray LENGTH 1- == IF
;every time
{ index ++
delaytime ME SETALARM
} index movearray LENGTH 1 - < IF
}
 
Was this article helpful? yes / no
Article details
Article ID: 44
Category: Room Scripts
Date added: 04-02-2011 13:16:31
Views: 608
Rating (Votes): Article not rated yet (0)

 
<< Go back

Powered by Help Desk Software HESK™