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
tomcat025
Wanderer


Joined: 30 Dec 2001
Posts: 66
Location: USA

PostPosted: Fri Nov 07, 2003 10:30 am   

Autoloot
 
I play a mud called Dragonrealms and am currenly trying to get an autoloot script/trigger running. THe problem is, I know not the place to start.

Game output when a corpse is searched is:

You search the crazed madman.
It carried a short sword.
You also find 1 bronze coin, 1 copper coin, a Guildleader Imaar card.

The brown section is what I want picked up. I figure I can capture and place each item in a variable and then have then taken up that way. There is another problem. the "keyword" for all items is not always in the same place. In the above example coin and card are the "keywords". However, there are instances where the keyword may be in the middle or even the front. Does anyone have any ideas how to proceed with this?

Ever the coding newbie,
Mike
Reply with quote
jurz
Novice


Joined: 22 Feb 2002
Posts: 48
Location: Latvia

PostPosted: Fri Nov 07, 2003 1:38 pm   
 
Could you post in more examples of what does the output looks like when keywords are in other places and show what exactly you want to capture.

-Jurz
Reply with quote
MattLofton
GURU


Joined: 23 Dec 2000
Posts: 4834
Location: USA

PostPosted: Fri Nov 07, 2003 11:56 pm   
 
#trigger {search *} {}
#condition {You search the *} {}
#condition {You also find (*).} {#variable loot %replace("%1",", ","|")}

That will get you a working list of item names. You then have two options:

1)if the item already exists in the item database (assuming you use one), simply reference the Keyword field for that item

2)if the item doesn't already exist or you are not using a database or similar construct, you have to brute-force your way through the entire item name (TIP: since most items use the last word as a keyword, start at the back)

#condition {You also find (*).} {#variable loot %replace("%1",", ","|");#variable wordposition %numwords(@Loot);get %word(%item(@Loot,1),@wordposition)}

#trigger {({You get a |You get an |You get some |I don't see what you're referring to})} {#if ("%1" = "I don't see what you're referring to") {#add wordposition -1} {#noop stuff to do to add item and keyword to database}}
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