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


Joined: 20 Nov 2006
Posts: 4

PostPosted: Mon Nov 20, 2006 3:32 pm   

help for new mud player??? please!
 
Hello,

I know this has been covered and I have tried going through some old
posts to get this information. But, there are so many ideas as to how to create herb balance I just confused myself even more.

Obviously, I am no Zmud expert but I am trying to learn. I understand how to create aliases, triggers, and variables. The problem comes when I try to create more involved scripts.

Trying to create a simple system for herb balance is driving me nuts.
Can anyone direct me to a post or help me begin my system with some simple steps? Not looking for an easy way out just some newbie steps for a newbie player.

Oh, I am trying to set up some sort of balance system for eating herbs in Imperian when learning combat.

Thanks!
Reply with quote
Fang Xianfu
GURU


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

PostPosted: Mon Nov 20, 2006 4:17 pm   
 
For Iron Realms, or what?
_________________
Rorso's syntax colouriser.

- Happy bunny is happy! (1/25)
Reply with quote
Confused
Newbie


Joined: 20 Nov 2006
Posts: 4

PostPosted: Mon Nov 20, 2006 4:21 pm   
 
Yes, sorry it is an Ironrealms game.

Thanks
Reply with quote
Fang Xianfu
GURU


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

PostPosted: Mon Nov 20, 2006 5:25 pm   
 
A good place to start is the Achaean Curing Project. It's still useful as an example that works, even if it's not for the game you actually play.

There're a few ways to create a herb balance system, but they all follow the same basic format:

1) Triggers that spot when you've been given afflictions and record which afflictions you've been given in some way.
2) A trigger based on the "can eat herbs again" that decides which herbs to eat based on some kind of priority order. Also includes a salve applying trigger and a pipe smoking trigger too, if they take your fancy.

There are tons of ways to store afflictions. The three ways I see it done most commonly are in a series of separate variables with the names of afflictions - @paralysis 1, @asthma 1 etc etc; as a string list in one variable: @afflictions: paralysis|asthma; and the way acp does it, as a singe database variable which uses the format @afflictions.affliction flag: @afflictions.paralysis 1 @afflictions.asthma 1. The first method is the easiest, but also the least robust. Which command you're going to use in your triggers depends on which method you choose. For each of the above, an example trigger would be:

#trig {%w paralyses you!} {paralysis = 1}
#trig {%w paralyses you!} {#additem afflictions paralysis}
#trig {%w paralyses you!} {#addkey afflictions paralysis 1}

Then comes the herb balance trigger itself, which will probably take the format of a string of nested #if statements (in CMUD you can just use #switch for this and save the horrid syntax, but for now:)

#if {@paralysis} {eat maidenhair} {#if (@asthma) {eat whatevertheasthmaherbis}}
#if (%ismember(@afflictions,paralysis)) {eat maidenhair} {#if (%ismember(@afflictions,asthma)) {eat asthmaherb}}
and so on. These examples prioritise paralysis over asthma - by changing the order, you can change which afflictions are cured before others.

As you can see, these triggers get pretty complicated pretty fast when there are 20+ afflictions. Then there are levels of complexity you can add in - you can't eat herbs while you have anorexia, so you'll have to add a check for that before you even start doing any of the processing above. And if you're stunned, or asleep, or any number of things. You can also add checks to see when you eat a herb, so that the system knows that the last thing it tried to eat went through. And then have a trigger on the message for "You can move your limbs again" or whatever that removes the record of paralysis in the system. And then to make it more illusion-proof, you can make it so that this trigger's only enabled one line after you eat a herb.

As a final note, if all of this seemed like I was talking total crap, I suggest writing some other systems first - auto-selfishness, auto health-sipping and so on. It helps you to get used to command syntax and things. Then move on to writing a simple curing system, then start making it more complicated. Don't be afraid to gut the whole thing and start over though - my first couple of attempts sucked :P
Reply with quote
Confused
Newbie


Joined: 20 Nov 2006
Posts: 4

PostPosted: Tue Nov 28, 2006 7:43 pm   
 
I just want to say thank you so very much for the information you posted. It really helped me get started and better understand some very basic coding.

I have been playing around with trying to code something for smoking my pipes. Basically, I want to be able to smoke and cure the most important stuff first.

My problem is I am not sure how to even start the coding. Should it be something like:
#If @asthma=0 {eKelp}
#if @aeon=1 {smoke pipe that has laurel in it}

and so on? Really sorry for the inexperienced coding, but as I said I am truly looking to learn!!
Reply with quote
Fang Xianfu
GURU


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

PostPosted: Tue Nov 28, 2006 8:12 pm   
 
As I said above, there are two major steps - detecting the affliction, and curing it. I assume you've got the first one down, since you don't mention it. From your example, I assume you're using a set of variables @afflictionname that are set to 0 when you don't have the affliction, and 1 when you do have the affliction. As for the second one, you can have a trigger like this:

#trig {You can smoke your pipes again.} {#var CanSmoke 1;SmokeCheck}
#alias {SmokeCheck} {#if (@CanSmoke) {#if (@asthma) {} {#if (@aeon) {smoke laurel;#var CanSmoke 0} {#if (@paralysis) {smoke valerian;#var CanSmoke 0}}}}}

I've colour coded that so you can see which ifs match which brackets. When you're able to smoke again, the trigger will set off the alias SmokeCheck. I use an alias for this so that things other than the trigger can set off the script, which I'll mention later.

First this script checks to see if you're able to smoke. This is just a precaution so it won't try and smoke if something other than this trigger has called the SmokeCheck alias - since the trigger will always set CanSmoke to 1 before it executes it, the system should always try to cure something if there's something to cure.

Next, the script checks to see if you're asthmatic. The @asthma variable (which should always be in brackets) will be 1 if you are, and 0 if you aren't, so the first command will be what happens if you're asthmatic. As you can see, in this example it'll do nothing because if it tried to smoke, nothing would happen.

Note: This is a perfect place to complicate your system. If you have herb and salve watches as well, this would be a perfect place to add their aliases (which is why they use aliases) - since the system knows you're asthmatic, it'd be good to have it try to cure that again in case your cure didn't go through the first time. These other aliases would also set off SmokeCheck if you were anorexic or slick, which is why we use an alias for this. In typical IRE fashion, though, this then leads to the problem of venom locks, which will have your script going round in circles, but that's another problem for another time :)

If you're not asthmatic, it'll process the false command, which will lead it to check if you're aeoned. If you are, it'll smoke laurel and tell the system that it needs to wait for smoke balance before trying again. If you're not, it'll move on and check if you're paralysed, and so on for each affliction you want to check.

This example is overly simple, but it gives you an idea of the kind of thing to expect. The next step once you've mastered this is to have the system detect if you actually managed to eat/drink/smoke/salve or whatever, so it knows to try again. If you don't manage to smoke in this case (say, you're asleep and though it tries to SMOKE LAUREL, you don't actually smoke it) the system will have no way of knowing this, and it'll still be waiting for the "You can smoke again" message before it'll try to cure another affliction.

As a starting point, though, this is as good as any.

EDIT: Blimey, they like to make scripting for IRE muds tough :( I sort of built all this stuff in as I went, haphazardly, so I never really noticed how much there is to do. I hope it's not too daunting, it does get simpler, I promise :P
Reply with quote
Confused
Newbie


Joined: 20 Nov 2006
Posts: 4

PostPosted: Wed Nov 29, 2006 5:18 am   
 
Daunting, oh yeah!! But, your examples have truly helped me. So much so I wanna change my name from 'confused' to 'not so confused'.

Again, thanks bunches for taking the time to help me out!!!!
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