Knowledgebase
Storm Palace Hosting > Storm Hosting Help Desk > Knowledgebase

Ask a question:


Animation Bundle

Solution ;Simplest animation script Ive seen written by Foxy
ON ENTER { 1 ME SETALARM }
ON ALARM {
6 pics = ;change 6 to the number of pictures you have
ME GETSPOTSTATE 1 + DUP pics / pics * -
;make 30 higher to slow down, lower to speed up
ME SETSPOTSTATELOCAL
30 ME SETALARM
}

;script to turn animation off and on by clicking on the spot:
ON SELECT { stat GLOBAL 1 stat - stat = < BR > 1 ME SETALARM }
ON ALARM { stat GLOBAL
{ 6 pics = ;change 6 to the number of pictures you have< BR > ME GETSPOTSTATE 1 + DUP pics / pics * -
ME SETSPOTSTATELOCAL
30 ME SETALARM
;make 30 higher to slow down, lower to speed up
} stat IF
}

;Animation Script using Frames
ON ENTER { 0 ME SETSPOTSTATELOCAL }
ON SELECT { frames GLOBAL
12 frames = ;change 12 to number of frames you want to show
1 ME SETALARM }
ON ALARM { frames GLOBAL
6 pics = ;change 6 to the number of pictures you have
ME GETSPOTSTATE 1 + DUP pics / pics * -
ME SETSPOTSTATELOCAL
frames --
{ 30 ME SETALARM ;make 30 higher to slow down, lower to speed up
} frames IF
}

If you have 6 pics and you want it to cycle thru them twice, then you want 12 frames
to show. If you want it to cycle 10 times, then you want 60 frames to show. Make
sure the blank.gif or none.gif is the first pic in your order of pics and the
0 ME SETSPOTSTATELOCAL on enter will make it so they see nothing until they click that spot.

;Animation script started and stopped by spoken word
ON ENTER { run GLOBAL
"Say on to turn the animation on, say off to turn it off" LOGMSG }
ON OUTCHAT { run GLOBAL
{ { "start" run = 10 ME SETALARM
"" CHATSTR = } "stop" run == IF } CHATSTR "on" == IF
{ "stop" run = "" CHATSTR = } CHATSTR "off" == IF
}
ON ALARM { run GLOBAL
{ 1 ME SETSPOTSTATELOCAL }
{ ME GETSPOTSTATE 1 + ME SETSPOTSTATELOCAL }
ME GETSPOTSTATE 8 > IFELSE
{ 10 ME SETALARM } "start" run == IF
{ 0 ME SETSPOTSTATELOCAL } "stop" run == IF
}

;standard animation script
ON ENTER {
0 ME SETSPOTSTATELOCAL
300 ME SETALARM }
ON ALARM {
{ 0 ME SETSPOTSTATELOCAL }
{ ME GETSPOTSTATE 1 + ME SETSPOTSTATELOCAL }
ME GETSPOTSTATE 7 >= IFELSE
300 ME SETALARM
}
;Just change the ^7 to one less than the total number of pics in your door.

;Animation Door to Door
;script by Alissa
;Will randomly toggle the pics in the spots listed in the array. In this case, spots [ 3 4 5 6 7 8 ]
ON ENTER { 10 ME SETALARM }
ON ALARM { lst GLOBAL
[ 3 4 5 6 7 8 ] 6 RANDOM GET nxt =
0 lst SETSPOTSTATELOCAL this lst =
1 nxt SETSPOTSTATELOCAL
100 ME SETALARM
}

Straight Forward approach to animating 14 spot pics:
ON ENTER { 0 ME SETSPOTSTATE }
ON SELECT {
{ 0 ME SETSPOTSTATE } 100 ALARMEXEC
{ 1 ME SETSPOTSTATE } 200 ALARMEXEC
{ 2 ME SETSPOTSTATE } 300 ALARMEXEC
{ 3 ME SETSPOTSTATE } 400 ALARMEXEC
{ 4 ME SETSPOTSTATE } 500 ALARMEXEC
{ 5 ME SETSPOTSTATE } 600 ALARMEXEC
{ 6 ME SETSPOTSTATE } 700 ALARMEXEC
{ 7 ME SETSPOTSTATE } 800 ALARMEXEC
{ 8 ME SETSPOTSTATE } 900 ALARMEXEC
{ 9 ME SETSPOTSTATE } 1000 ALARMEXEC
{ 10 ME SETSPOTSTATE } 1100 ALARMEXEC
{ 11 ME SETSPOTSTATE } 1200 ALARMEXEC
{ 12 ME SETSPOTSTATE } 1300 ALARMEXEC
{ 13 ME SETSPOTSTATE } 1400 ALARMEXEC
}

;One pic animation script:
ON ENTER {
0 ME SETSPOTSTATELOCAL
{ 1 ME SETSPOTSTATELOCAL } 180 ALARMEXEC
}

;Another simple animation script
;if you are using the background as one pic and adding one to a door.
ON ENTER
{ 40 ME SETALARM }
ON ALARM
{ ME GETSPOTSTATE NOT ME SETSPOTSTATELOCAL
40 ME SETALARM }

;Animation Script explained that loops and doesnt:
ON ENTER {
10 ME SETALARM ; launch loop upon enter
}
ON ALARM {
{
0 ME SETSPOTSTATELOCAL ; reset [or...]
} {
ME GETSPOTSTATE 1 + ME SETSPOTSTATELOCAL ; advance one
} ME GETSPOTSTATE 10 > IFELSE ; loop clause
40 ME SETALARM ; loop again in 40 ticks
}
;To make it stop at the end:
ON ENTER {
10 ME SETALARM ; launch loop upon enter
}
ON ALARM {
{
ME GETSPOTSTATE 1 + ME SETSPOTSTATELOCAL ; advance one
40 ME SETALARM ; loop again in 40 ticks
} ME GETSPOTSTATE 11 < IF ; until 11 pics done
}

Animation Spots explained:
if you have 4 pics loaded in a door, when you set the spotstate to 4,
there is no picture associated with that number, so it just displays the
background... with the loop number set to the number of pics you have
loaded, as the script loops it is displaying the pics in this order
(assuming you have 4 pics):
pict1 ; spotstate 0
pict2 ; spotstate 1
pict3 ; spotstate 2
pict4 ; spotstate 3
blank ; spotstate 4
pict1 ; spotstate 0
etc....

if you set the loop number to one less than the number of pics, the
result is like this:

pict1 ; spotstate 0
pict2 ; spotstate 1
pict3 ; spotstate 2
pict4 ; spotstate 3
pict1 ; spotstate 0
etc...
 
Was this article helpful? yes / no
Article details
Article ID: 223
Category: Room Scripts
Date added: 07-11-2011 20:39:37
Views: 1130
Rating (Votes): Article not rated yet (0)

 
<< Go back

Powered by Help Desk Software HESK™