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
jluce7
Beginner


Joined: 20 Dec 2005
Posts: 22

PostPosted: Thu Feb 23, 2006 2:18 am   

Stringlist Troubles for an inept person
 
First, here's what I am doing. I am messing around trying to set a curing order via a stringlist variable. We'll say HerbCures is the list name.

So I trigger the stuff to #ADDITEM herb HerbCures (or %additem sometimes). Anyway, there are some that I want to be at the TOP of this list. Is there a way to make it so I don't have to "code in" IF statements for %ismember type stuff? I would like certain herbs to automatically be placed higher on the pecking order in this as it will be a healing queue type thing. Right now I can only think of assigning each one a numbered prefix like 1_importantherb, 2_nextimportantherb and doing a %sort on it. The curing order will/should be mostly static for my needs.

With that then, my next question. Once I get it all specified in the order of precence I want, how do I access the string's first item and say #IF (Firstiteminlist=x) {y} {z} to make it ACT on it (assuming maybe an #EXEC???
Reply with quote
TonDiening
GURU


Joined: 26 Jul 2001
Posts: 1958
Location: Canada

PostPosted: Thu Feb 23, 2006 4:27 am   
 
To put it in the top:
#VAR HerbCures%push("Herb in front",@HerbCures)

You can data clean by using %ismember to see if it is in the queue or is already at position 1.
Depends if you want unique or multiples, you can also use #DELITEM if a successful cure of a type went through.

#alias cureOne {rub head with herbone}
#alias cureTwo {eat herbtwo}

#var HerbCures "One|Two"

cure%pop(HerbCures)

That'll probably work.

Other ways is to check to see if you have the objects necessary and make a list of commands (instead of herbs etc) to execute when you get balance. You can also add weights to the items for your string list.
Reply with quote
jluce7
Beginner


Joined: 20 Dec 2005
Posts: 22

PostPosted: Thu Feb 23, 2006 6:18 pm   
 
TonDiening wrote:
To put it in the top:
#VAR HerbCures%push("Herb in front",@HerbCures)

You can data clean by using %ismember to see if it is in the queue or is already at position 1.
Depends if you want unique or multiples, you can also use #DELITEM if a successful cure of a type went through.

#alias cureOne {rub head with herbone}
#alias cureTwo {eat herbtwo}

#var HerbCures "One|Two"

cure%pop(HerbCures)

That'll probably work.

Other ways is to check to see if you have the objects necessary and make a list of commands (instead of herbs etc) to execute when you get balance. You can also add weights to the items for your string list.


Ok this didn't appear to post before...but I kind of changed directions. Instead of listing the cure in the string, I am doing the affliction since you can only be afflicted by one of each thing.

Now, I can Focus some cures, eat some cures, salve for some cures, smoke some cures, or a combination for some of them.

So I have now, a stringlist VAR set to be the precendence of healing, and another showing the current afflictions.

How would I make them compare? I want it to look through the focusable cures first, if it's in there, focus it and remove from afflictions, if not, go to herbs, repeat, if not, go to smoking. However I need to avoid (since some you can do either/or for) focusing AND eating the herb.

Here's what I got so far:
#VAR focuscures {stupidity|anorexia|retardation|ashtma...}
#VAR herbalcures {paralysed|anorexia|stupidity|ashtma...}

Those are the list of afflictions each type can handle and the order I want the herbs cured in, (focus is random)

Then I have another variable for Currentafflictions. I need to basically check to see if anything is in @currentafflictions and then see if it's focusable, if not move to herbs...avoiding the double focus/eat scenario.

Would an alias after each affliction work:??

#ALIAS CUREME {#IF (%ismember(@afflictions) AND %ismember(@focuscures)) {focus} {#IF (%ismember(@afflictions) AND %ismember(@herbalcures) {outbelt and eat the right herb} {CHECK SMOKE CURES...}}}

So it would look something like this:

#TRIGGER {^You suddenly become a raging script-tard$} {#ADDITEM CurrentAfflictions moronic;CUREME}...

Of course, plant/salve and focus balance also comes into play which might make it harder.

I'd appreciate as much help as I can get. Thank you.
Reply with quote
TonDiening
GURU


Joined: 26 Jul 2001
Posts: 1958
Location: Canada

PostPosted: Thu Feb 23, 2006 8:36 pm   
 
You should search the forums for "queue" or "queueing" as what you are doing is making a priority list of actions to automatically execute when you are in a ready (balanced) state.

Also look into the magnificant work by Larkin and others in the Achaea healing bots.
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