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

Play RetroMUD
Post new topic  Reply to topic     Home » Forums » CMUD General Discussion
chamenas
Wizard


Joined: 26 Mar 2008
Posts: 1547

PostPosted: Tue Apr 01, 2008 12:47 pm   

More Expression Questions....
 
So, I was transferring my triggers to the command form for storage when I realized a large hole in them that needs to be fixed.

Code:

#TRIGGER Sanctuary {The white aura around your body fades.$} {
#IF (@posn="wake" AND @status="noidle") {
#send "quaff greenish"
} {
#send wake
#send "quaff greenish"
#send sleep
}


The problem is, I may be idle, but not sleep! In that instance, it will see the idle, fail, "wake" me up, then put me to sleep. Were I programming in C++, I'd remedy this with an else if statement (else if (@posn="wake" AND @status="idle). How would I achieve this same effect in CMUD?

Also, a bonus question. I made a bunch of triggers and such available for others to use, having made them in CMUD. I figured the compatibility should make it so that only a few things in CMUD would not work in zMUD. However, someone using zMUD was unable to use:

Code:

#oninput {^w>(%w) (*)} {#noinput;pmote ~{wwhispers ~(to ~{c%1~{w~) '~{c%-2~{w'~{x } {General Triggers}


IS that normal, or is there something wrong here?
Reply with quote
Fang Xianfu
GURU


Joined: 26 Jan 2004
Posts: 5155
Location: United Kingdom

PostPosted: Tue Apr 01, 2008 1:08 pm   
 
You can use the #switch command for elseifs. Also, you don't need to use #send every time you want to send text to the MUD - you can safely remove all the #send commands there and just have

Code:
#IF (@posn="wake" AND @status="noidle") {
quaff greenish
} {
wake
quaff greenish
sleep
}


And you missed a closing bracket in your script, but I guess that's just a typo.

There's no #noinput command in zMUD, you need to use #gag instead. #gag in CMUD just stops the command being displayed on the screen.
_________________
Rorso's syntax colouriser.

- Happy bunny is happy! (1/25)
Reply with quote
chamenas
Wizard


Joined: 26 Mar 2008
Posts: 1547

PostPosted: Tue Apr 01, 2008 2:26 pm   
 
Something like this?

Code:

#TRIGGER Sanctuary {The white aura around your body fades.$} {
#IF (@posn="wake" AND @status="noidle")
{
quaff greenish
}

#SWITCH (@posn="sleep" AND @status="noidle")
{
wake
quaff greenish
sleep
}

{
#say "posn="@posn and status=~[@status~] || ***Trigger did not run***
}

}


And...

Code:

#oninput {^w>(%w) (*)} {#gag;pmote ~{wwhispers ~(to ~{c%1~{w~) '~{c%-2~{w'~{x } {General Triggers}
Reply with quote
Dharkael
Enchanter


Joined: 05 Mar 2003
Posts: 593
Location: Canada

PostPosted: Tue Apr 01, 2008 3:02 pm   
 
You dont need an #IF and a #SWITCH both, the #SWITCH is your IF and your ELSE IF
Code:
#TRIGGER Sanctuary {^The white aura around your body fades.$} {
#SWITCH (@posn="wake" AND @status="noidle") {
   quaff greenish
}
  (@posn="sleep" AND @status="noidle") {
   wake
   quaff greenish
   sleep 
}
   {#say "posn="@posn and status=~[@status~] || ***Trigger did not run*** }
}



And in zMUD and CMUD you only need to #gag or #noinput if in your oninput trigger you DON'T send any text to the mud.
Since you are doing so in your oninput trigger zMUD/CMUD wont send the original line.
_________________
-Dharkael-
"No matter how subtle the wizard, a knife between the shoulder blades will seriously cramp his style."
Reply with quote
chamenas
Wizard


Joined: 26 Mar 2008
Posts: 1547

PostPosted: Tue Apr 01, 2008 3:45 pm   
 
Dharkael wrote:

And in zMUD and CMUD you only need to #gag or #noinput if in your oninput trigger you DON'T send any text to the mud.
Since you are doing so in your oninput trigger zMUD/CMUD wont send the original line.


I admit I took it from Fang without understanding it, so you're not making any sense to me. Whatever Fang gave me worked in CMUD, but seems to fail in zMUD, so I just wanted to know why.
Reply with quote
Zugg
MASTER


Joined: 25 Sep 2000
Posts: 23379
Location: Colorado, USA

PostPosted: Tue Apr 01, 2008 4:40 pm   
 
zMUD and CMUD are not the same program. CMUD has *many* new features that do not exist in zMUD. So while most zMUD scripts will work in CMUD (that's called backwards compatibility), you probably will *not* be able to run your CMUD scripts within zMUD. zMUD doesn't have the #NOINPUT command and doesn't have #SWITCH (among other things).
Reply with quote
chamenas
Wizard


Joined: 26 Mar 2008
Posts: 1547

PostPosted: Tue Apr 01, 2008 4:51 pm   
 
I figured that. The question was how to achieve the same thing, if that was possible.
_________________
Listen to my Guitar - If you like it, listen to more
Reply with quote
Dharkael
Enchanter


Joined: 05 Mar 2003
Posts: 593
Location: Canada

PostPosted: Tue Apr 01, 2008 4:56 pm   
 
Remove the #gag its not necessary.
Code:
#oninput {^w>(%w) (*)} {pmote ~{wwhispers ~(to ~{c%1~{w~) '~{c%2~{w'~{x } {General Triggers}

That should work in both CMUD and zMUD.
_________________
-Dharkael-
"No matter how subtle the wizard, a knife between the shoulder blades will seriously cramp his style."
Reply with quote
Fang Xianfu
GURU


Joined: 26 Jan 2004
Posts: 5155
Location: United Kingdom

PostPosted: Tue Apr 01, 2008 5:02 pm   
 
You can just nest the #ifs (or run them one after the other since there's no way both can be true at the same time) instead of using #switch, too. So the false-command of one #if will be another #if.
_________________
Rorso's syntax colouriser.

- Happy bunny is happy! (1/25)
Reply with quote
Display posts from previous:   
Post new topic   Reply to topic     Home » Forums » CMUD 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