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


Joined: 21 Nov 2002
Posts: 2
Location: USA

PostPosted: Thu Nov 21, 2002 11:33 pm   

Case function
 
Hey Guys,

I play Achaea and I am desperately trying to understand the case function on
Zmud to allow me to illusion random afflictions to my targets. I already
have a print and bounded version of the manual from June 9th, 1999-version
5.54. I currently use 6.36B and I checked that help file as well. I am
such a neophyte to programming and such. Is there anywhere where I can get a
layman's summary of how to use the case feature?

I would like to have a random affliction of my choice from a group that I specify trigger when I use the alias to conjure an illusion of the affliction. Any help that you guys can give me would be greatly appreciated.

Much appreciated.

Serp.
Reply with quote
MattLofton
GURU


Joined: 23 Dec 2000
Posts: 4834
Location: USA

PostPosted: Thu Nov 21, 2002 11:46 pm   
 
quote:

Hey Guys,

I play Achaea and I am desperately trying to understand the case function on
Zmud to allow me to illusion random afflictions to my targets. I already
have a print and bounded version of the manual from June 9th, 1999-version
5.54. I currently use 6.36B and I checked that help file as well. I am
such a neophyte to programming and such. Is there anywhere where I can get a
layman's summary of how to use the case feature?

I would like to have a random affliction of my choice from a group that I specify trigger when I use the alias to conjure an illusion of the affliction. Any help that you guys can give me would be greatly appreciated.

Much appreciated.

Serp.





%case() returns text, so you'd use it like this:

#var choice %case(@selection, option1, option2, option3, optionN, ...)

I believe %case() will return a 0 or null character if you go beyond the listed options.

#CASE, on the other hand, sends text to the MUD:

#CASE @selection {option1} {option2} {option3} {option4}

#CASE will not send a null character to the MUD if you go beyond the maximum number of options, but will instead wrap around to the front of the list. In the above example, if @selection = 5, then option1 would be executed.

li'l shmoe of Dragon's Gate MUD
Reply with quote
Serpentlord
Newbie


Joined: 21 Nov 2002
Posts: 2
Location: USA

PostPosted: Mon Nov 25, 2002 11:06 pm   
 
Hey Matt,

Thanks for the reply ;) Unfortunately I am still a useless as ever. I am not sure what to do with what you have given me. Let's say that I have an alias that goes like this:

alias 5= #ig;conjure illusion Serpent bites you and you wince in pain. A pr*ckly sensation overcomes you, fading away into numbness.;#ig; secrete poison;bite @target.

Now what I want to do of course is make the illusion a random set of illusions. As it stands there is only that paralysis illusion. How would I plug this into the example that you have given me to reflect different afflictions? Additionally, is it plugged into the aliases window or the main Zmud command window at the bottom?

Much appreciated,

Serpentlord.
quote:

Hey Guys,

I play Achaea and I am desperately trying to understand the case function on
Zmud to allow me to illusion random afflictions to my targets. I already
have a print and bounded version of the manual from June 9th, 1999-version
5.54. I currently use 6.36B and I checked that help file as well. I am
such a neophyte to programming and such. Is there anywhere where I can get a
layman's summary of how to use the case feature?

I would like to have a random affliction of my choice from a group that I specify trigger when I use the alias to conjure an illusion of the affliction. Any help that you guys can give me would be greatly appreciated.

Much appreciated.

Serp.





%case() returns text, so you'd use it like this:

#var choice %case(@selection, option1, option2, option3, optionN, ...)

I believe %case() will return a 0 or null character if you go beyond the listed options.

#CASE, on the other hand, sends text to the MUD:

#CASE @selection {option1} {option2} {option3} {option4}

#CASE will not send a null character to the MUD if you go beyond the maximum number of options, but will instead wrap around to the front of the list. In the above example, if @selection = 5, then option1 would be executed.

li'l shmoe of Dragon's Gate MUD

Reply with quote
LightBulb
MASTER


Joined: 28 Nov 2000
Posts: 4817
Location: USA

PostPosted: Tue Nov 26, 2002 1:09 am   
 
quote:

Hey Matt,

Thanks for the reply ;) Unfortunately I am still a useless as ever. I am not sure what to do with what you have given me. Let's say that I have an alias that goes like this:

alias 5= #ig;conjure illusion Serpent bites you and you wince in pain. A pr*ckly sensation overcomes you, fading away into numbness.;#ig; secrete poison;bite @target.

Now what I want to do of course is make the illusion a random set of illusions. As it stands there is only that paralysis illusion. How would I plug this into the example that you have given me to reflect different afflictions? Additionally, is it plugged into the aliases window or the main Zmud command window at the bottom?

Much appreciated,

Serpentlord.
quote:

Hey Guys,

I play Achaea and I am desperately trying to understand the case function on
Zmud to allow me to illusion random afflictions to my targets. I already
have a print and bounded version of the manual from June 9th, 1999-version
5.54. I currently use 6.36B and I checked that help file as well. I am
such a neophyte to programming and such. Is there anywhere where I can get a
layman's summary of how to use the case feature?

I would like to have a random affliction of my choice from a group that I specify trigger when I use the alias to conjure an illusion of the affliction. Any help that you guys can give me would be greatly appreciated.

Much appreciated.

Serp.





%case() returns text, so you'd use it like this:

#var choice %case(@selection, option1, option2, option3, optionN, ...)

I believe %case() will return a 0 or null character if you go beyond the listed options.

#CASE, on the other hand, sends text to the MUD:

#CASE @selection {option1} {option2} {option3} {option4}

#CASE will not send a null character to the MUD if you go beyond the maximum number of options, but will instead wrap around to the front of the list. In the above example, if @selection = 5, then option1 would be executed.

li'l shmoe of Dragon's Gate MUD






(adds to the chain of meaningless quotes)

There's no reason to use either %case or #CASE for this. %item will do the job.
#AL illusion {cast illusion %item(@illusions, %random(1, %numitems(@illusions)))}
Then use #ADDITEM to put your illusions into @illusions.
#ADDITEM illusions {Your left leg shrivels}
#ADDITEM illusions {You have been struck blind}


LightBulb
Senior Member
Reply with quote
lYPhiD
Newbie


Joined: 28 Nov 2002
Posts: 3
Location: Australia

PostPosted: Thu Nov 28, 2002 1:43 pm   
 
also i am talking achaea here,
ok i have another case question, that may be related?

can any case function be used to recognise letters instead of numbers for the choices

i have a prompt:
400h, 300m ex-
-or-
%1h, %2m %3-

and would like my trigger to repsond to %3 being any combination of letters

at the moment i just use about seven #IF statements to match %3
that looks like this

#IF %3=ex {req_ex} {#IF %3=e {req_e} {#IF %3=e {req_x}}}

#ALIAS req_ex {balance=1;equib=1;#NOOP %btncol(5,76)}
#ALIAS req_e {balance=0;equib=1;#NOOP %btncol(5,0)}
#ALIAS req_x {balance=1;equib=0;#NOOP %btncol(5,0)}
Reply with quote
LightBulb
MASTER


Joined: 28 Nov 2000
Posts: 4817
Location: USA

PostPosted: Thu Nov 28, 2002 6:38 pm   
 
No, both %case and #CASE require a number as the index. A clever person could probably convert that string into a number, but that's a subject for another thread. It would take just as much (probably more) work as using #IFs anyway.

LightBulb
Senior Member
Reply with quote
Tarn
GURU


Joined: 10 Oct 2000
Posts: 873
Location: USA

PostPosted: Thu Nov 28, 2002 6:53 pm   
 
quote:

It would take just as much (probably more) work as using #IFs anyway.



Or he could have just the one trigger capturing the prompt, and set each variable by using %pos to check if each flag is in the prompt. (Eliminates the nested IF's in favor of separate ones for each flag)

Also: look up 'pattern' in the help index. It will give you a much better list of wildcard types than the old Tintin syntax %1, etc.

-Tarn
Reply with quote
MattLofton
GURU


Joined: 23 Dec 2000
Posts: 4834
Location: USA

PostPosted: Fri Nov 29, 2002 4:27 am   
 
If the e and x appear in specific places and a placeholder appears when e or x is not present, we can assume that there are only four possible outcomes:

ex
e-
-x
--

We can include three other combinations if the e and x characters can appear in either location:

xe
x-
-e

We can then use those combinations to derive a numeric case condition to determine what we need to do:

#case %ismember(%3,"ex|e-|x-|--|xe|-e|-x") {#noop this is for when both e and x are present} {#noop this is for when only e is present} {#noop this is for when only x is present} {#noop this is for when e and x are not present}

Because of standard #CASE behavior, we need only define 4 separate conditions, assuming that "ex" = "xe", "e-" = "-e", and "x-" = "-x".

li'l shmoe of Dragon's Gate MUD
Reply with quote
Tarn
GURU


Joined: 10 Oct 2000
Posts: 873
Location: USA

PostPosted: Fri Nov 29, 2002 5:06 am   
 
quote:

If the e and x appear in specific places and a placeholder appears when e or x is not present, we can assume that there are only four possible outcomes:



That assumption isn't correct.

Also, 'e' and 'x' aren't the only flags that can appear there.

The best approach I've found is to capture it as a sequence of letters and look in the resulting string for individual letter flags.

-Tarn
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