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


Joined: 13 May 2002
Posts: 0
Location: USA

PostPosted: Fri Apr 12, 2002 12:32 pm   

Need help on making a vendor bot
 
I know the basics of triggers but I don't know how to make the bot detect increases in gold. I play Realms of Despair, and I want my bot to know that it's being given gold instead of someone just emoting it. Can anyone give me a script that would help this work?
I would have a prompt with maybe (10 gold).
Let's say I am selling magic mushrooms for 5 gold each.
If someone gives me 5 gold, I would give them the mushroom.
How would this be scripted to make sure the trigger doesn't set off on an emote, but instead from an actual increase in 5 gold?

Can anyone help me please?
Reply with quote
Toetag
Magician


Joined: 10 Oct 2000
Posts: 356
Location: USA

PostPosted: Fri Apr 12, 2002 2:09 pm   
 
not sure how ROD displays emotes, are there any screen differences? I take it not since you are posting this.

You'd have to do some sort of current gold vs. new gold test to determine a gold increase. If no gold difference, no mushroom given.

With the mud I play (Chalacyn Nights). I would do an SC (score) and read the value of gold before and after to determine if i should give an item out. It's a bit spammy on the screen, but it's the only way to check my gold value.

If your emotes are displayed differently then you might have to use the ^ (^ force pattern to match starting at the beginning of the line) in the trigger.

IE:

^* gives you * gold.


would match:
John gives you 5 gold.

but not:
emote John gives you 5 gold.

Killing a fly on a friends forhead may not be overkill, use a hatchet to make sure the job is done.
Reply with quote
LightBulb
MASTER


Joined: 28 Nov 2000
Posts: 4817
Location: USA

PostPosted: Fri Apr 12, 2002 2:18 pm   
 
#VAR gold 10 Put the number you have right now
#TR {(%w) gives you (%d) gold} {#VAR buyer %1;worth}
#TR {You have (%d) gold} {#IF (%1 - @gold > 4) {#VAR gold %1;give mushroom @buyer};#VAR buyer %null}


Something like that. Exact wording depends on what commands/methods you have for determining how much gold you have.


LightBulb
Vague questions get vague answers
Reply with quote
Troubadour
GURU


Joined: 14 Oct 2000
Posts: 556
Location: USA

PostPosted: Fri Apr 12, 2002 4:51 pm   
 
Modify your in game prompt to show gold on hand.

Modify your prompt trigger to include the following commands:


#TR {%dhp %dma %dmv (%d)gp} {
#VAR gold %1
#IF @isVending {
#VAR isVending 0
#IF (%eval(@gold - @lastgold) = 5) {give mushroom @buyer} {say Nice try buddy!}
}
} "" "prompt"
Note that your prompt probably varies and that your prompt doesn't have to look exactly like the above example. I'm just highlighting the pattern elements and commands needed for vending.

Next, make another trigger to initiate a vending event.


#TR {(%w) gives you %x coins.} {
#VAR lastgold @gold
#VAR buyer %1
#VAR isVending 1
}


Whenever you receive a prompt, @gold is updated. Whenever somebody gives you gold, the amount in @gold is stored in @lastgold before the next prompt is received. Additionally the buyer's name is stored and the @isVending flag is set to 1 (true).

At the next prompt, @gold is updated with the new balance. Since @isVending is now true, the next commands are executed. @isVending is reset to 0, then @gold and @lastgold are compared to see if 5 gold was received. If so, the mushroom is given; if not, a snotty retort is said.



Troubadour
Reply with quote
insanity_2000
Newbie


Joined: 13 May 2002
Posts: 0
Location: USA

PostPosted: Fri Apr 12, 2002 6:24 pm   
 
Thanks for the help guys.

I'm still having problems tho.

Troubadour, yours seems to be the right way, but I can't get the syntax to work. Well, the zmud 6.16 keeps saying it's wrong. Maybe cuz I just copy and pasted.
Reply with quote
Troubadour
GURU


Joined: 14 Oct 2000
Posts: 556
Location: USA

PostPosted: Fri Apr 12, 2002 6:57 pm   
 
Yeah, because I used the evil code tags, you can't cut and paste my post. Some say that's a bad thing, I think it forces folks to learn about what they're copying.

Troubadour
Reply with quote
insanity_2000
Newbie


Joined: 13 May 2002
Posts: 0
Location: USA

PostPosted: Fri Apr 12, 2002 6:58 pm   
 
Ok I Finally got it working.

but something is still wrong, the trigger shooting at prompt will cause a loot, and when i test if someone gives me 5 coins, the trigger will keep shooting off.

how could I fix this?
Reply with quote
insanity_2000
Newbie


Joined: 13 May 2002
Posts: 0
Location: USA

PostPosted: Fri Apr 12, 2002 7:07 pm   
 
LOL

I figured it out!! THANKS TROUBADOUR!!
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