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
yskar
Newbie


Joined: 25 Aug 2004
Posts: 7

PostPosted: Wed Aug 25, 2004 7:55 pm   

While loop with toggled variables
 
What Im trying to do here is have a macro that will toggle a set of actions:

When its clicked it sets a variable @aw to 'on' and issues the command 'autoloot on' plus it starts performing an alias called 1mg every 4 seconds. When I toggle the macro off I want to set the @aw to 'off', issue the command 'autoloot off' and stop the loop.

Heres the code i have so far.

#if (@aw = "on") {
autoloot off
mgcount=300
aw = "off"
} {
autoloot on

aw = "on"

mgcount=1

#while (@mgcount < 300) {
1mg
#add @mgcount+1
#wait 4000
}
}


But this ends up sending most of the above to zmud as code. Where am I going wrong?

thanks
Reply with quote
mr_kent
Enchanter


Joined: 10 Oct 2000
Posts: 698

PostPosted: Wed Aug 25, 2004 8:25 pm   
 
#IF (@aw = "on") {autoloot off;#T- mg_alarm;aw="off"} {autoloot on;#VAR mgcount 1;#ALARM mg_alarm *4 {1mg;#IF (@mgcount = "300") {#T- mg_alarm};#ADD mgcount 1};aw="on"}
Reply with quote
yskar
Newbie


Joined: 25 Aug 2004
Posts: 7

PostPosted: Thu Aug 26, 2004 5:43 am   
 
Its not quite working.

The first click with the autoloot off starts the loop ok. The second click doesnt disable it and is sent to the mud as

#if (on = on) {
autowake off
} {autowake on;aw = on}
Reply with quote
LightBulb
MASTER


Joined: 28 Nov 2000
Posts: 4817
Location: USA

PostPosted: Wed Sep 01, 2004 6:57 pm   
 
Mr Kent's #IF commands are correct. You probably left out one or more }'s.
_________________
LightBulb
Senior member

Most scripts in this forum are written for Command Line entry.
Don't even open the Settings Editor unless its use is specified or obvious.
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