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


Joined: 10 Apr 2003
Posts: 45
Location: USA

PostPosted: Tue Apr 06, 2004 10:42 am   

Are these aliases correct?
 
It seems the system I wrote for Achaea still isn't working quite right, and I've gotten conflicting advice on how to fix it.

This is one of my curing aliases. Each of the two-or-three letter contents inside each of the {} brackets are individual aliases for each of my herbs and salves. For example, eg is outr 1 goldenseal;eat goldenseal.

#ALIAS herbheal
#If (@herbbalance=1 AND @anorexia=0 AND @stun=0 AND @sleeping=0) {
#If (@stupidity=1) {eg}
#If (@paralysis=1) {ebr}
#If (@asthma=1) {ekl}
#If (@insomnia=0) {ecoh}
#If (@pacifism=1) {ebe}
#If (@tranquil=1) {ebe}
#If (@lust=1) {ebe}
#If (@merciful=1) {ebe}
#If (@hypersomnia=1) {eas}
#If (@confusion=1) {eas}
#If (@dizziness=1) {eg}
#If (@impatience=1) {eg}
#If (@scytherus=1) {egi}
#If (@dissonance=1) {eg}
#If (@addiction=1) {egi}
#If (@dementia=1) {eas}
#If (@sensitivity=1) {ekl}
#If (@deafness=0) {eha}
#If (@blindness=0) {eba}
#If (@lethargy=1) {egi}
#If (@darkshade=1) {egi}
#If (@clumsiness=1) {ekl}
#If (@masochism=1) {elb}
#If (@generosity=1) {ebe}
#If (@justice=1) {ebe}
#If (@weakness=1) {ekl}
#If (@hallucinations=1) {eas}
#If (@shyness=1) {eg}
#If (@loneliness=1) {elb}
#If (@recklessness=1) {elb}
#If (@claustrophobia=1) {elb}
#If (@agoraphobia=1) {elb}
#If (@nausea=1) {egi}
#If (@vertigo=1) {elb}
}

I've been told I can do either:

#If (@vertigo) {elb}

OR

#If (@vertigo=1) {elb}

But it seems that the way it's currently written, the whole thing goes totally haywire.

Here's my salve alias:

#ALIAS salveheal

#IF (@salvebalance=1 AND @slickness=0 AND @stun=0 AND @sleeping=0) {
#If (@anorexia=1) {ae}
#If (@frozen=1) {acl}
#If (@ablaze=1) {ame}
#If (@headdamage=1) {arh}
#If (@torsodamage=1) {arb}
#If (@bothlegdamage=1) {arl}
#If (@leftlegdamage=1) {arl}
#If (@rightlegdamage=1) {arl}
#If (@legdamage=1) {arl}
#If (@botharmdamage=1) {ara}
#If (@leftarmdamage=1) {ara}
#If (@rightarmdamage=1) {ara}
#If (@armdamage=1) {ara}
#If (@shivering=1) {acl}
#If (@headbroke=1) {amh}
#If (@torsobroke=1) {amt}
#If (@bothlegbroke=1) {aml}
#If (@leftlegbroke=1) {aml}
#If (@rightlegbroke=1) {aml}
#If (@legbroke=1) {aml}
#If (@botharmbroke=1) {amr}
#If (@leftarmbroke=1) {amr}
#If (@rightarmbroke=1) {amr}
#If (@armbroke=1) {amr}
#If (@mass=0) {ama}
}

Also, do I just use one close-bracket symbol } at the very end of the alias, or do I have to use one for every IF inside the { open-bracket symbol? That is, the salveheal alias, after opening the bracket when it's checked for salvebalance, slickness, sleeping and stun, has 25 IF statements in the salve queue. Do I need 25 } symbols after {ama} ? Do I need 26? 24? Or is just the one correct? I'd been told the syntax checker can make mistakes.

The system checks for balances in a separate folder called BALANCE.

The variables are herbbalance, salvebalance, and elixbalance.

Trigger:

#TRIGGER You eat a goldenseal root. {herbbalance = 0}

(There's one trigger for each herb, plus: )

#TRIGGER You take a drink from a %w vial. {elixbalance = 0}
#TRIGGER You take out some salve and quickly rub it on * {salvebalance = 1}

Finally, the following triggers:

#TRIGGER You may apply another salve to yourself. {salvebalance=1;#ECHO SALVE BALANCE!!;salveheal
(salveheal is the alias that does salve curing)

#TRIGGER You may eat another plant. {herbbalance=1;#ECHO HERB BALANCE!!;herbheal
(herbheal is the alias that does herb curing)

Also one for elixirs, and health potion.

This is the heart of my system and I know that any bugs will be found in what's been listed here. Is it all correct, or do there appear to be problems?

Holly
Reply with quote
nexela
Wizard


Joined: 15 Jan 2002
Posts: 1644
Location: USA

PostPosted: Tue Apr 06, 2004 11:19 am   
 
quote:
#If (@vertigo) {elb} OR #If (@vertigo=1) {elb}


Both of these are correct and will return TRUE if @vertigo is 1, the first option will ALSO return true if @vertigo is 1 or greater than 1

quote:
Also, do I just use one close-bracket symbol } at the very end of the alias, or do I have to use one for every IF inside the { open-bracket symbol? That is, the salveheal alias, after opening the bracket when it's checked for salvebalance, slickness, sleeping and stun, has 25 IF statements in the salve queue. Do I need 25 } symbols after {ama} ? Do I need 26? 24? Or is just the one correct? I'd been told the syntax checker can make mistakes.



#IF (expression) {True} {OPTIONAL FALSE}
OR
#IF (expression) {
#if (expression) {True}
}

So no you don't need any more or less brackets then what you have .

Your Alias and triggers are correct However your syntax for pasteing them into the command line is wrong.
#TR {pattern} {commands}
#ALIAS name {commands}

Edit: Finished what I was saying
Reply with quote
HollyC
Novice


Joined: 10 Apr 2003
Posts: 45
Location: USA

PostPosted: Tue Apr 06, 2004 7:06 pm   
 
Well, please realize that I don't write scripts quite the same way all of you are accustomed to doing. I don't write everything line by line in a single text file in Notepad or something and load it into ZMud-- if that's even how you DO a script for it.

What I did to write everything was in ZMud's offline mode, I clicked the CLASS ICON, which brings up a window to show all the class folders. Then in that window I clicked the ALL button, to show all variables, aliases, triggers, stat bars, button bars, etc. Using the drop down menu for NEW, I created all the data using that window as a template, then clicked SAVE AS and gave the .mud file a name.

However, short of exporting the entire system, folder by folder, to Notepad and pasting it here-- and the system in its entirety would be prohibitively long-- I cannot copy/paste from ZMud directly to my browser and the "Forum Reply" window. So while I don't manually type:

#ALIAS name {command}

Here, I'll export the sub-folder the HERBHEAL, SALVEHEAL, and ELIXHEAL aliases are in:

#CLASS {Holly|healing|healme}
#ALIAS herbheal {#If (@herbbalance=1 AND @anorexia=0 AND @stun=0 AND @sleeping=0) {#If (@stupidity=1) {eg};#If (@paralysis=1) {ebr};#If (@asthma=1) {ekl};#If (@insomnia=1) {ecoh};#If (@pacifism=1) {ebe};#If (@tranquil=1) {ebe};#If (@lust=1) {ebe};#If (@merciful=1) {ebe};#If (@hypersomnia=1) {eas};#If (@confusion=1) {eas};#If (@dizziness=1) {eg};#If (@impatience=1) {eg};#If (@scytherus=1) {egi};#If (@dissonance=1) {eg};#If (@addiction=1) {egi};#If (@dementia=1) {eas};#If (@sensitivity=1) {ekl};#If (@deafness=0) {eha};#If (@blindness=0) {eba};#If (@lethargy=1) {egi};#If (@darkshade=1) {egi};#If (@clumsiness=1) {ekl};#If (@masochism=1) {elb};#If (@generosity=1) {ebe};#If (@justice=1) {ebe};#If (@weakness=1) {ekl};#If (@hallucinations=1) {eas};#If (@shyness=1) {eg};#If (@loneliness=1) {elb};#If (@recklessness=1) {elb};#If (@claustrophobia=1) {elb};#If (@agoraphobia=1) {elb};#If (@nausea=1) {egi};#If (@vertigo=1) {elb}}}
#ALIAS salveheal {#IF (@salvebalance=1 AND @slickness=0 AND @stun=0 AND @sleeping=0) {#If (@anorexia=1) {ae};#If (@frozen=1) {acl};#If (@ablaze=1) {ame};#If (@headdamage=1) {arh};#If (@torsodamage=1) {arb};#If (@bothlegdamage=1) {arl};#If (@leftlegdamage=1) {arl};#If (@rightlegdamage=1) {arl};#If (@legdamage=1) {arl};#If (@botharmdamage=1) {ara};#If (@leftarmdamage=1) {ara};#If (@rightarmdamage=1) {ara};#If (@armdamage=1) {ara};#If (@shivering=1) {acl};#If (@headbroke=1) {amh};#If (@torsobroke=1) {amt};#If (@bothlegbroke=1) {aml};#If (@leftlegbroke=1) {aml};#If (@rightlegbroke=1) {aml};#If (@legbroke=1) {aml};#If (@botharmbroke=1) {amr};#If (@leftarmbroke=1) {amr};#If (@rightarmbroke=1) {amr};#If (@armbroke=1) {amr};#If (@mass=0) {ama}}}
#ALIAS elixheal {#If (@elixbalance=1 AND @anorexia=0 AND @stun=0 AND @sleeping=0) {#If (@voyria=1) {dimm};#If (@speed=0) {dks};#If (@frost=0) {dkf};#If (@levitation=0) {dkl}}}
#ALIAS pipeheal {#IF (@asthma=0 AND @sleeping=0 AND @stun=0) {#IF (@rebounding = 0) {ssp};#IF (@slickness = 1) {svp};#IF (@aeon = 1) {sep};#IF (@hellsight = 1) {sep};#IF (@disloyalty = 1) {svp}}}
#KEY F1 {pipeheal;salveheal;herbheal;elixheal;dhei}
#CLASS 0

Here's an export of the balance folder:

#CLASS {Holly|healing|balance}
#VAR elixbalance {1} {1}
#VAR salvebalance {1} {1}
#VAR herbbalance {1} {1}
#TRIGGER {You may drink another affliction-healing elixir.} {elixbalance=1;#ECHO !!ELIXIR BALANCE!!;elixheal}
#TRIGGER {You may apply another salve to yourself.} {salvebalance=1;#ECHO !!SALVE BALANCE!!;salveheal}
#TRIGGER {You may eat another plant.} {herbbalance=1;#echo !!HERB BALANCE!!;herbheal}
#TRIGGER {You take a drink from a %w vial.} {elixbalance = 0}
#TRIGGER {You take out some salve and quickly rub it on *} {salvebalance = 0}
#TRIGGER {You eat some *****ly ash bark.} {herbbalance = 0}
#TRIGGER {You eat a bloodroot leaf.} {herbbalance = 0}
#TRIGGER {You eat a ginseng root.} {herbbalance = 0}
#TRIGGER {You eat a goldenseal root.} {herbbalance = 0}
#TRIGGER {You eat a piece of kelp.} {herbbalance = 0}
#TRIGGER {You eat a lobelia seed.} {herbbalance = 0}
#TRIGGER {You eat some bayberry bark.} {herbbalance = 0}
#TRIGGER {You eat a hawthorn berry.} {herbbalance = 0}
#CLASS 0

The double values for the variables is because "1" is BOTH the DEFAULT and the current VALUE.

Now, I realize that when a double affliction is given, it is possible the system will attempt to eat both herbs simultaneously; however, I have noticed that as soon as the first herb is eaten, it will then delay the second until herb balance is regained due to the "You eat a (name of plant)" triggers. To put the {herbbalance = 0} with the actual affliction line, such as "You feel a tightening sensation grow in your lungs," then things like anorexia, stupidity, etc. preventing the herb from actually being eaten, can result in herbbalance remaining at 0 indefinitely. The same with "outr 1 (herb);eat (herb)" being made the trigger to set herbbalance to 0: stupidity and other factors can prevent herbbalance from being reset to 1.

Please let me know if you'd like me to try and export the entire system/script to Notepad and post it here. I think it might be too long, but if any of the "ZMud gurus" feel it's the best way to evaluate the entire kit and kaboodle, I'll give it a go.

Holly
Reply with quote
annex187
Beginner


Joined: 16 Mar 2003
Posts: 16
Location: USA

PostPosted: Tue Apr 06, 2004 9:06 pm   
 
I'm not a 'Zmud Guru,' Holly, but I think I can help with this. The IF statement you use to check for herb balance etc is good but the problem is that if you have herbbalance, it goes down the list and tries to cure every affliction you have. So you need to use #ABORT after each curing alias. As an example, if you have stupidity cure it and then abort the curing alias:
#IF (@stupidity=1) {eg;#ABORT}

It will be rerun when you are afflicted again or regain herb balance. Another thing that may be causing a problem is at the beginning of your IF statement. When checking more than one variables, I've always had to place each in perentheses and the whole set of variables in another perentheses.

So instead of:
#If (@herbbalance=1 AND @anorexia=0 AND @stun=0 AND @sleeping=0)

You may want to use
#If ((@herbbalance=1) AND (@anorexia=0) AND (@stun=0) AND (@sleeping=0))


I hope this clears things and that it isn't as confusing as I'm dreading it will be.
Reply with quote
Vijilante
SubAdmin


Joined: 18 Nov 2001
Posts: 5182

PostPosted: Tue Apr 06, 2004 10:34 pm   
 
I think you should either use another flag or an if-else chain. For example:
#ALIAS herbheal {#If ((@herbbalance=1) AND (@anorexia=0) AND (@stun=0) AND (@sleeping=0)) {#If ((@stupidity=1) & (@herbeating=0)) {eg};#If ((@paralysis=1) & (@herbeating=0)) {ebr};#If ((@asthma=1) & (@herbeating=0)) {ekl};#If ((@insomnia=1) & (@herbeating=0)) {ecoh};#If ((@pacifism=1) & (@herbeating=0)) {ebe};#If ((@tranquil=1) & (@herbeating=0)) {ebe};#If ((@lust=1) & (@herbeating=0)) {ebe};#If ((@merciful=1) & (@herbeating=0)) {ebe};#If ((@hypersomnia=1) & (@herbeating=0)) {eas};#If ((@confusion=1) & (@herbeating=0)) {eas};#If ((@dizziness=1) & (@herbeating=0)) {eg};#If ((@impatience=1) & (@herbeating=0)) {eg};#If ((@scytherus=1) & (@herbeating=0)) {egi};#If ((@dissonance=1) & (@herbeating=0)) {eg};#If ((@addiction=1) & (@herbeating=0)) {egi};#If ((@dementia=1) & (@herbeating=0)) {eas};#If ((@sensitivity=1) & (@herbeating=0)) {ekl};#If ((@deafness=0) & (@herbeating=0)) {eha};#If ((@blindness=0) & (@herbeating=0)) {eba};#If ((@lethargy=1) & (@herbeating=0)) {egi};#If ((@darkshade=1) & (@herbeating=0)) {egi};#If ((@clumsiness=1) & (@herbeating=0)) {ekl};#If ((@masochism=1) & (@herbeating=0)) {elb};#If ((@generosity=1) & (@herbeating=0)) {ebe};#If ((@justice=1) & (@herbeating=0)) {ebe};#If ((@weakness=1) & (@herbeating=0)) {ekl};#If ((@hallucinations=1) & (@herbeating=0)) {eas};#If ((@shyness=1) & (@herbeating=0)) {eg};#If ((@loneliness=1) & (@herbeating=0)) {elb};#If ((@recklessness=1) & (@herbeating=0)) {elb};#If ((@claustrophobia=1) & (@herbeating=0)) {elb};#If ((@agoraphobia=1) & (@herbeating=0)) {elb};#If ((@nausea=1) & (@herbeating=0)) {egi};#If ((@vertigo=1) & (@herbeating=0)) {elb}}}
That would be a second flag. This will prevent 2 cures from being used at a time, but requires you to also update all you aliases to set the flag and your triggers to clear it. The blue changes are just what annex187 suggested; while they are technically unecessary I do reccommend them.

#ALIAS herbheal {#If (@herbbalance=1 AND @anorexia=0 AND @stun=0 AND @sleeping=0) {#If (@stupidity=1) {eg} {#If (@paralysis=1) {ebr} {#If (@asthma=1) {ekl} {#If (@insomnia=1) {ecoh} {#If (@pacifism=1) {ebe} {#If (@tranquil=1) {ebe} {#If (@lust=1) {ebe} {#If (@merciful=1) {ebe} {#If (@hypersomnia=1) {eas} {#If (@confusion=1) {eas} {#If (@dizziness=1) {eg} {#If (@impatience=1) {eg} {#If (@scytherus=1) {egi} {#If (@dissonance=1) {eg} {#If (@addiction=1) {egi} {#If (@dementia=1) {eas} {#If (@sensitivity=1) {ekl} {#If (@deafness=0) {eha} {#If (@blindness=0) {eba} {#If (@lethargy=1) {egi} {#If (@darkshade=1) {egi} {#If (@clumsiness=1) {ekl} {#If (@masochism=1) {elb} {#If (@generosity=1) {ebe} {#If (@justice=1) {ebe} {#If (@weakness=1) {ekl} {#If (@hallucinations=1) {eas} {#If (@shyness=1) {eg} {#If (@loneliness=1) {elb} {#If (@recklessness=1) {elb} {#If (@claustrophobia=1) {elb} {#If (@agoraphobia=1) {elb} {#If (@nausea=1) {egi} {#If (@vertigo=1) {elb}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}
That would be an if-else chain. Again it ensure that only one of the IFs can be taken.

There is a yet another option. That is to store the action to be taken into a variable then once all IFs have been done preform the action. For example:
{#If (@stupidity=1) {doherb="eg"};#If (@paralysis=1) {doherb="ebr"};#If (@asthma=1) {doherb="ekl"};#EXEC @doherb
This again is designed to prevent multiple actions from being taken. In all cases this appears to be your problem I would suggest rewriting how you store the afflictions into a different form so that a single IF can handle it. The first form that pops into mind is a list, and the only IF required is just to check that it contains something. After that you can use %item or %pop to handle the decision of what to cure. Since you need some sort of priority, your current script provides that without the necessary exclusivity; you should couple the list with a record variable containing all your afflictions (or use your current variables). Then once you send a healing command you can rebuild the list. This allows that you have nearly no delay due to scripts because the delay is covered while awaiting balance. Your triggers that detect new afflictions should of course check balance (might want to check the list too) and if you don't have balance initiate rebuilding of the list. Again the goal is to hide the processing time, programmers have been doing this since they started calling themselves as such. Good luck.
Reply with quote
HollyC
Novice


Joined: 10 Apr 2003
Posts: 45
Location: USA

PostPosted: Fri Apr 09, 2004 8:12 am   
 
Hi. Excuse the delay in replying. A number of people are helping me on this, and everyone is contradicting everyone else, which makes me wonder who's right and who's wrong, because if I go entirely by what one person says, and that person is wrong, so am I *laugh*

Annex, I looked up the #abort command in ZMud help. I'm not entirely sure, but if I go like this:

#If (@stupidity=1) {eg;#abort} #If (@paralysis=1) {ebr;#abort} #If (@asthma=1) {ekl;#abort} #If (@insomnia=0) {ecoh;#abort} #If (@pacifism=0) {ebe;#abort} etc.

Suppose I am hit with both asthma and removal of my insomnia at the same time (setting asthma to 1 and insomnia to 0). Eating kelp for asthma would stop the abort command (since asthma returns true) and thus it would go straight to the insomnia check, see it is true, and attempt to cure it right away. On the other hand, that double affliction does not include stupidity; therefore, stupidity would be 0. This would make it go to the ELSE statement (abort) instead of the THEN statement (eg) and stop the entire script, leaving me with both asthma up and insomnia down. Am I correct, or no? Please explain either way.

Holly :)
Reply with quote
Lightblade
Newbie


Joined: 13 May 2004
Posts: 1
Location: USA

PostPosted: Thu May 13, 2004 3:12 am   
 
I need help. I don't understand how to set up curing scripts. This is also for Achaea. For one from what you have shown does the system know you are afflicted with say vertigo? wouldn't you have to use diagnose me to be able to heal anything? If you have to hit diagnose every 2 seconds in a fight how could you ever win? I am confused here.

I have all of my afflictions triggered by the message of the affliction then value being the cure such as ebl or eat bloodroot etc. Problem is I need something to get balance figured out so I don't miss healing myself. In a fight say I am afflicted with paralysis twice I eat bloodroot then immediately after eat bloodroot again since I was hit twice, yet since I just ate some i just get the plant has no effect and, therefore, I do not cure paralysis the second time. I am not sure what you are all talking about and why you are putting these in classes like this. I am pretty new to Zmud so I need help.
Reply with quote
LightBulb
MASTER


Joined: 28 Nov 2000
Posts: 4817
Location: USA

PostPosted: Thu May 13, 2004 6:58 pm   
 
I'll try to keep this short so I won't be contradicting anyone else, just clarifying some points.
quote:
Your Alias and triggers are correct However your syntax for pasteing them into the command line is wrong.

The aliases should look like this, with an opening bracket on the first line and another closing bracket at the end (I considerably shortened the alias for demonstration purposes).
#ALIAS herbheal {
#If (@herbbalance=1 AND @anorexia=0 AND @stun=0 AND @sleeping=0) {
#If (@stupidity=1) {eg}
#If (@vertigo=1) {elb}
}
}

Your triggers should look like this, with brackets around the pattern.
#TRIGGER {You eat a goldenseal root.} {herbbalance = 0}

quote:
Also, do I just use one close-bracket symbol } at the very end of the alias, or do I have to use one for every IF inside the { open-bracket symbol? That is, the salveheal alias, after opening the bracket when it's checked for salvebalance, slickness, sleeping and stun, has 25 IF statements in the salve queue. Do I need 25 } symbols after {ama} ? Do I need 26? 24? Or is just the one correct? I'd been told the syntax checker can make mistakes.

You need one close-bracket for each open-bracket. However, only the final close-bracket has to be at the end and only the first open-bracket has to be at the beginning. These are the two in red in my example. Your #IFs aren't nested, so your closing-brackets are fine.

quote:
I'd been told the syntax checker can make mistakes.

Yes, it can. It sometimes reports syntax errors even though the syntax is correct, just not what the syntax checker expected. That is, sometimes it reports errors on settings which work anyway. It's very good at picking up mismatched brackets though.
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