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


Joined: 14 Aug 2005
Posts: 4

PostPosted: Sun Aug 14, 2005 10:10 am   

trying to create a script that does two things.
 
I've been trying to create a script that triggers on a line and text, and each time the trigger fires, it adds to a variable.

Each time the variable hits a certain number, I want a command to be sent to the mud, and the variable reset.

It'd go like this:

[important line of text] scrolls by.

#add var1

if var1 = 3, [send desired command, reset var1]

Could anyone help?
Reply with quote
Rappy
Wanderer


Joined: 15 Jul 2005
Posts: 96

PostPosted: Sun Aug 14, 2005 10:52 am   
 
Code:

#TRIGGER {important line of text} {#ADD var1 1;#IF {@var1 = 3} {do this;var1 = 0}}


-Rappy
_________________
Windows 11 Pro,
cMUD 3.34
Reply with quote
climbjtree
Newbie


Joined: 14 Aug 2005
Posts: 4

PostPosted: Sun Aug 14, 2005 11:03 am   
 
thanks Rappy for the speedy response.

In my brainstorming though, I forgot something.

The trigger is for learning magic, and there are two possible outcomes in the situation.

You practice the spell, and it either says:

You finished practicing.
You think you would have succeeded.

Or:

You finished practicing.


If you think you succeed three times in a row, thats when you need the command to be sent to the mud. If you miss it once, and you just get "You finished practicing," I need the var to be reset.

Is that possible?
Reply with quote
Rappy
Wanderer


Joined: 15 Jul 2005
Posts: 96

PostPosted: Mon Aug 15, 2005 10:35 am   
 
You mean something like this...

untested (damn eLic)

Code:

#TRIGGER {You finished practicing.$(*)$} {
  #IF {%1 = You think you would have succeeded.} {
    #ADD var1 1
    #IF {@var1 = 3} {
      send this to the MUD //3 successes
      var1 = 0 //reset variable
    }
  } {var1 = 0} //oops I didn't succeed, set variable to 0 and try again.
}


-Rappy
_________________
Windows 11 Pro,
cMUD 3.34
Reply with quote
climbjtree
Newbie


Joined: 14 Aug 2005
Posts: 4

PostPosted: Tue Aug 16, 2005 9:23 am   
 
Thanks again Rappy.

However, for some reason, it's not picking up the 'you think you would have succeeded.'

I've tried to fix it myself, but still can't figure it out. Any ideas?
Reply with quote
Kiasyn
Apprentice


Joined: 05 Dec 2004
Posts: 196
Location: New Zealand

PostPosted: Tue Aug 16, 2005 2:42 pm   
 
Code:

#TRIGGER {You finished practicing.} {
   #ALARM +2 {
      #IF (@var1 = 3) {
         do this
         var1 = 0
      }
   }
}
#TRIGGER {You think you would have succeeded.} {
#ADD var1 1
}


not very efficent... but it should work in most cases..
_________________
Kiasyn
Owner of Legends of Drazon
Coder on Dark Legacy
Check out Talon, an easy IMC connection.
Reply with quote
nexela
Wizard


Joined: 15 Jan 2002
Posts: 1644
Location: USA

PostPosted: Tue Aug 16, 2005 11:54 pm   
 
Zmud supports very powerfull conditional triggers!

Code:
#TRIGGER {You finished practicing.} {}
#COND {} {
 #IF (%trigger="You think you would have succeeded.") {
  #ADD var1 1
  #IF (@var1>=3)) {
   #SAY Do this on third message
   #VAR var1 0
  }
 } {#VAR var1 0}
} {within|param=1}
_________________
Zmud Support Library
Zmud Knowledge Base
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