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
Craivus
Novice


Joined: 24 Jan 2001
Posts: 47

PostPosted: Wed Apr 09, 2003 1:49 am   

#WAIT versus #TEMP {*} (and a variable question)
 
Alright, I figured that #TEMP {*} would be a good alternative to #WAIT. Unfortunately, #WAIT is working for me and the other option is screwing up. Here is an example alias, do_stones:



remove 1 stone from my sjatmal stones
#TEMP {*Roundtime*} {
#WAIT
#math int_waitfor {@roundtime + 1}
#ALARM +@int_waitfor {
combine my sjatmal stone with my other sjatmal stone
#TEMP {*Roundtime*} {
#WAIT
#math int_waitfor {@roundtime + 1}
#ALARM +@int_waitfor {#if (@stones = 1) {do_stones}}
}
}
}


Works as expected. Sends remove stone, waits till end of roundtime, combines them, repeats.



remove 1 stone from my sjatmal stones
#TEMP {*Roundtime*} {
#TEMP {*} {
#math int_waitfor {@roundtime + 1}
#ALARM +@int_waitfor {
combine my sjatmal stone with my other sjatmal stone
#TEMP {*Roundtime*} {
#TEMP {*} {
#math int_waitfor {@roundtime + 1}
#ALARM +@int_waitfor {#if (@stones = 1) {do_stones}}
}
}
}
}
}


This one sends "combine stones" one second or so after the remove stone command (roundtime is 5 seconds), thereby being completely screwy.


I should note that the REASON I am wanting to pause for mud output after the *Roundtime* trig is matched, is because my triggers which capture the roundtime are GSL triggers, and work on an (invisible to me) GSL string sent from the mud AFTER the Roundtime string. There does not seem to be a way to create a GSL trigger from within a script... if there is, I'd like to hear it, but I'd also like to get the above working in its current state.

Help!


Also, how do you explicitly specify the class of a variable when calling it? Say I do this...

#VAR mystring {Hello} {Myclass}
#VAR mystring {HEllo} {Myotherclass}

How do I change

#ECHO @mystring

to use the correct one, depending which one I want ?
Reply with quote
MattLofton
GURU


Joined: 23 Dec 2000
Posts: 4834
Location: USA

PostPosted: Wed Apr 09, 2003 2:54 am   
 
Well, you're out of luck on the last question if you're not using 6.40 or later (or whatever beta version in which this feature was added). In that version, Zugg added limited OOP capability to settings. It involves the / character, but I don't bother using it so I can't tell you how.

li'l shmoe of Dragon's Gate MUD
Reply with quote
kilthan
Wanderer


Joined: 21 Jan 2003
Posts: 76

PostPosted: Thu Apr 10, 2003 3:31 pm   
 
I don't understand the need to make an alias with temporary triggers. Why not just use permanent triggers and use aliases to enable and disable them. Easier and simpler in my opinion.

So this is what I would do:


#ALIAS do_stones {#T+ mechstones;remove 1 stone}
#ALIAS stop_stones {#T- mechstones}


#TRIGGER "mechstones" {You count one stone from the %w stones.} {}
#COND {q} {
#MATH int_waitfor {@roundtime + 1}
#ALARM +@int_waitfor {combine my stone with my other stone}
} {gsl}
#COND {You combine your %w stones.}
#COND {q} {
#MATH int_waitfor {@roundtime + 1}
#ALARM +@int_waitfor {remove 1 stone}
} {gsl}

Honestly I don't see the need for figuring out the roundtime since it's constant, the following is what my triggers look like. And by not figuring out the roundtime you could go with your temporary trigger approach.


#TRIGGER "mechstones" {You count one stone from the %w stones.} {#ALARM +6 {combine my stone with my other stone}}
#COND {You combine your %w stones.} {#ALARM +6 {remove 1 stone}}



quote:

#VAR mystring {Hello} {Myclass}
#VAR mystring {HEllo} {Myotherclass}

How do I change

#ECHO @mystring



#ECHO /Myclass/@mystring
#ECHO /Myotherclass/@mystring




quote:

Well, you're out of luck on the last question if you're not using 6.40 or later (or whatever beta version in which this feature was added). In that version, Zugg added limited OOP capability to settings. It involves the / character, but I don't bother using it so I can't tell you how.

li'l shmoe of Dragon's Gate MUD



He's using GSL triggers, It's a newer version.


BTW - why are + signs removed in preview?
Reply with quote
Anabasis
Wanderer


Joined: 26 Jan 2001
Posts: 74

PostPosted: Fri Apr 11, 2003 3:04 pm   
 
You seem to have set up a rather elaborate function for this. If you insist on keeping all of the needed components inside the script, I'd follow Kilthan's excellent advice.

However, you may want to look into the completed scripts folder and pick yourself up a command buffer. That would keep you from having to duplicate the same functions again and again through your scripts.

The one I use for DR allows me to stack up commands, but will not execute them if I'm in RT, stunned, dead, webbed, etc. Pretty much all my scripts just feed commands into it, and it fires out commands every few seconds.

Ana
Reply with quote
itsmarty
Novice


Joined: 29 Jan 2002
Posts: 37
Location: USA

PostPosted: Fri Apr 11, 2003 5:27 pm   
 
I'm curious about the roundtime section:
quote:
#math int_waitfor {@roundtime + 1}
#ALARM +@int_waitfor{}


Can you use a condition that waits for @roundtime to equal zero instead? I assume most Simu players are counting down roundtime in a gauge, so it should already be available for this purpose as well.

BTW, I've been using the command buffer from the finished scripts since it was posted, and I really like it. You have to jump through a few extra hoops to get it working now, though, because the prompt is handled differently in versions of zmud that work with gsl codes.

Martin

Martin
http://mywebpages.comcast.net/itsmarty/
Reply with quote
kilthan
Wanderer


Joined: 21 Jan 2003
Posts: 76

PostPosted: Fri Apr 11, 2003 5:50 pm   
 
to wait for roundtime to equal zero you would have to do something like this

#TRIGGER {Pattern}
#COND {q} {} {gsl}
#COND {!(roundtime>0)} {#ALARM +1 {whatever}}


Doesn't really matter which way you go with it. Never really experiment with roundtime in scripts since the few I use have constant roundtimes or none.
Reply with quote
kilthan
Wanderer


Joined: 21 Jan 2003
Posts: 76

PostPosted: Fri Apr 11, 2003 6:59 pm   
 
quote:

quote:

#VAR mystring {Hello} {Myclass}
#VAR mystring {HEllo} {Myotherclass}

How do I change

#ECHO @mystring



#ECHO /Myclass/@mystring
#ECHO /Myotherclass/@mystring



Sorry that's wrong it should be:

#ECHO @Myclass/mystring
#ECHO @Myotherclass/mystring
Reply with quote
Craivus
Novice


Joined: 24 Jan 2001
Posts: 47

PostPosted: Sun Apr 13, 2003 1:30 am   
 
Thanks for all the advice all, I'll play around with it... still, though, does anyone know why #TEMP {*} is not working as expected?
Reply with quote
Craivus
Novice


Joined: 24 Jan 2001
Posts: 47

PostPosted: Sun Apr 13, 2003 1:36 am   
 
Also, can someone point me to a good explanation of #COND and trigger-states? I haven't been zmud-programming since back way before they were invented, and the help seems to be lacking on them.
Reply with quote
Anabasis
Wanderer


Joined: 26 Jan 2001
Posts: 74

PostPosted: Sun Apr 13, 2003 3:25 am   
 
quote:
Also, can someone point me to a good explanation of #COND and trigger-states?


There's this in the support library.

http://www.zuggsoft.com/library/trigadv.htm

Ana
Reply with quote
LightBulb
MASTER


Joined: 28 Nov 2000
Posts: 4817
Location: USA

PostPosted: Sun Apr 13, 2003 3:39 am   
 
quote:
still, though, does anyone know why #TEMP {*} is not working as expected?

Wrong expectations, probably.

The * will match anything, including the line that just set off the trigger which created the #TEMP.

LightBulb
Advanced Member
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