Register to post in forums, or Log in to your existing account
 

Play RetroMUD
Post new topic  Reply to topic     Home » Forums » zMUD General Discussion
nazradin
Apprentice


Joined: 23 Mar 2003
Posts: 114
Location: New Zealand

PostPosted: Wed Apr 23, 2003 4:17 am   

%i script question
 

currently i am using

#ALIAS spellup {prep 911;cast;#ALARM +4 {prep 911;cast;#ALARM +4 {prep 401;cast;#ALARM +4 {prep 406;cast;#ALARM +4 {prep 419;cast;#ALARM +4 {prep 503;cast;#ALARM +4 {prep 507;cast;#ALARM +4 {prep 507;cast;#ALARM +4 {prep 507;cast;#ALARM +4 {prep 508;cast;#ALARM +4 {prep 508;cast;#ALARM +4 {prep 509;cast;#ALARM +4 {prep 509;cast;#ALARM +4 {prep 513;cast;#ALARM +4 {prep 513;cast;#ALARM +4 {prep 905;cast;#ALARM +4 {prep 905;cast;#ALARM +4 {prep 905;cast;#ALARM +4 {prep 913;cast;#ALARM +4 {prep 919;cast;#ALARM +4 {prep 919;cast}}}}}}}}}}}}}}}}}}}}}

as my spellup script, i am trying to change it to a more compact and versatile script using %i


#CLASS {Gemstone|Spells|Spellup}
#ALIAS spellrefresher {#FORALL @spellrefresh {
#VAR commands {%additem( prep @%i, @commands)}
#VAR commands {%additem( cast, @commands)}
}}
#VAR spellrefresh {401|406|414|503}
#TRIGGER {Cast Roundtime (%d) Seconds.} {#ALARM +%1 {#IF (@commands) {
#SEND %item( @commands, 1)
#DELNITEM commands 1
#IF (@commands) {
#SEND %item( @commands, 1)
#DELNITEM commands 1
}
}}}
#CLASS 0


but this just loops and the first varaible and does not move to next, i have to exit to stop.

question
a: can anyone see what is wrong
b: is there a way to stop or pause a script while it is running?

Nazradin
Reply with quote
LightBulb
MASTER


Joined: 28 Nov 2000
Posts: 4817
Location: USA

PostPosted: Wed Apr 23, 2003 5:45 am   
 
Instead of looking for what's wrong, just do something simpler.
#AL spellup {#VAR spellup {911|911|401|406|419};#T+ Spellrefresher}
#CLASS Spellrefresher disable
#ALA *4 {#IF (%numitems( @spellup)) {prep %item( @spellup, 1);cast %item( @spellup, 1);#DELN spellup 1} {#T- Spellrefresher}}
#CLASS 0

LightBulb
Advanced Member
Reply with quote
nazradin
Apprentice


Joined: 23 Mar 2003
Posts: 114
Location: New Zealand

PostPosted: Thu Apr 24, 2003 4:15 pm   
 
quote:

Instead of looking for what's wrong, just do something simpler.
#AL spellup {#VAR spellup {911|911|401|406|419};#T+ Spellrefresher}
#CLASS Spellrefresher disable
#ALA *4 {#IF (%numitems( @spellup)) {prep %item( @spellup, 1);cast %item( @spellup, 1);#DELN spellup 1} {#T- Spellrefresher}}
#CLASS 0

LightBulb
Advanced Member



thats great thanks lightbulb, it also works as a way of converting my current travel scripts

#CLASS {travel}
#ALIAS movement {#VAR movement {w|w|w|n|w|n|n|n|n|n|n|e|n|go gate|nw|nw|go bridge|nw};#T+ traveldisable}
#CLASS 0

#CLASS {travel|traveldisable}
#ALARM {*2} {#IF (%numitems( @movement)) {%item( @movement, 1);#DELN movement 1} {#T- traveldisable}}
#CLASS 0

question (and i know this may be very basic)is there a way to change easily variable strings so that i can use then use the alias to run different scripts or do i need to make multiple class folders and turn them on/off as needed with multiple versions of the same named variable (although i could see that as problematic

cheers Nazardin
Reply with quote
LightBulb
MASTER


Joined: 28 Nov 2000
Posts: 4817
Location: USA

PostPosted: Thu Apr 24, 2003 4:52 pm   
 
If you're using aliases similar to my example, which create the variable as part of the script, you can certainly use the same variable/class/alarm for all of them. Just be sure to let each one finish before doing the next. You might want to include an informational command (#SAY, #MESS, etc) when you reach the end to help you avoid overwriting the variable early.

LightBulb
Advanced Member
Reply with quote
nazradin
Apprentice


Joined: 23 Mar 2003
Posts: 114
Location: New Zealand

PostPosted: Fri Apr 25, 2003 6:08 pm   
 
quote:

If you're using aliases similar to my example, which create the variable as part of the script, you can certainly use the same variable/class/alarm for all of them. Just be sure to let each one finish before doing the next. You might want to include an informational command (#SAY, #MESS, etc) when you reach the end to help you avoid overwriting the variable early.

LightBulb
Advanced Member



thanks again lighbulb now have a way to convert all my travel scripts, can't make it pause to wait on things like a ferry arriving(well i could by having a trigger that turns the script class off if ferrry etc isnt in room i guess but that seems a bit much work) so an just break them down into pieces a bit more.

#CLASS {travel}
#ALIAS orchard_val {movement = {cli wall|se|s|s|go path|e|n|ne|e|e|ne|go trail|se|go bridge|se|se|go Gate|s|w|s|s|s|s|s|s|e|s|e|e|e}}
#ALIAS val_orchard {movement = {w|w|w|n|w|n|n|n|n|n|n|e|n|go gate|nw|nw|go bridge|nw|go trail|sw|w|w|sw|sw|go path|n|n|nw|climb north wall}}
#BUTTON 52 {orchard_val} {orchard_val} {} {} {} {} {} {Size} {100} {17} {Pos} {1} {600} {} {} {} {} "" {} {} {} {3}
#BUTTON 53 {val_orchard} {val_orchard} {} {} {} {} {} {Size} {100} {17} {Pos} {1} {700} {} {} {} {} "" {} {} {} {3}
#CLASS 0

#CLASS {travel|traveldisable}
#ALARM {*1} {#IF (%numitems( @movement) AND (@rt = 0)) {%item( @movement, 1);#DELN movement 1}}
#CLASS 0

thanks Nazardin
Reply with quote
Display posts from previous:   
Post new topic   Reply to topic     Home » Forums » zMUD General Discussion All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum

© 2009 Zugg Software. Hosted by Wolfpaw.net