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


Joined: 08 Jun 2004
Posts: 36

PostPosted: Sat Jun 12, 2004 10:29 pm   

Item scanning.. sorting..
 
Hey all. I'm not real sure how to even start this one. So i'm just going to post as much info as I can and if yall can help thanks a bunch.

The game i play uses big numbers assigned to items to differientiate between to like objects. For instance, if I type id i get this output.

>id
The ID numbers of the items here are:

streetlamp: 9056269
bounty poster: 670455
sign: 107552
man o war: 3316086
man o war: 4112154
legion of the city guard: 5481107
man o war: 5753798
clipper: 5918948
clipper: 6791093
man o war: 6872698
trawler: 7295646
caravel: 7349658
man o war: 7434253
clipper: 7730303
clipper: 7829977
clipper: 7912318
clipper: 8083949
legion of the city guard: 8096349
clipper: 8309943
clipper: 8340769
man o war: 8602381
clipper: 8631841
clipper: 8678879
clipper: 8699640
clipper: 8709441
clipper: 8732966
clipper: 8756717
trawler: 8848352
clipper: 8853943
clipper: 8868376
clipper: 8939891
pack of cards: 8937335
clipper: 9045628
builder: 8838322
>Builder walks east.

What I want it to do is scan the numbers beside the item, store it, give it a first second third reference based on where it is on the list above, top to bottom, and then allow me to type in : enter first manowar

which would then output enter 3316086.

My eyesget all screwy when i see that many numbers together, i seem to mix them up and its hard for me to remember them all anyways..
Thanks if anyone can help.
Reply with quote
Danlo
Magician


Joined: 28 Nov 2003
Posts: 313
Location: Australia

PostPosted: Sun Jun 13, 2004 10:33 am   
 
This will do what you require:

#ALIAS Enter {#ECHO %db(@ItemsScanned,%lower(%replace("%-2"," ",""))%1)}
#TRIGGER {The ID numbers of the items here are:} {#T+ ItemScan}
#CLASS ItemScan
#TRIGGER {(*): (%d)} {#addkey VarNums %replace("%1"," ","") %eval(%db(@VarNums,%replace("%1"," ",""))+1);#addkey ItemsScanned %lower(%replace("%1"," ",""))%db(@VarNums,%lower(%replace("%1"," ",""))) %2}
#TRIGGER {~>} {#T- ItemScan}
#CLASS 0

Usage: Enter ReferenceNR Name
Eg: Enter 1 Man O War
Reply with quote
LightBulb
MASTER


Joined: 28 Nov 2000
Posts: 4817
Location: USA

PostPosted: Sun Jun 13, 2004 6:33 pm   
 
First of all, Danlo's solution will probably work provided you make two changes.
1. In the #ALIAS, replace #ECHO with ~enter
2. Add commands to the first trigger to clear the variables
#VAR ItemsScanned {}
#VAR VarNums {}

Modified version of Danlo's script
#ALIAS Enter {~enter %db(@ItemsScanned,%lower(%replace("%-2"," ",""))%1)}
#TRIGGER {The ID numbers of the items here are:} {#T+ ItemScan;#VAR VarNums {};#VAR ItemsScanned {}}
#CLASS ItemScan
#TRIGGER {(*): (%d)} {#addkey VarNums %replace("%1"," ","") %eval(%db(@VarNums,%replace("%1"," ",""))+1);#addkey ItemsScanned %lower(%replace("%1"," ",""))%db(@VarNums,%lower(%replace("%1"," ",""))) %2}
#TRIGGER {~>} {#T- ItemScan}
#CLASS 0

However, it might be easier to create a Speed Menu so that you can just right-click the item you want to enter, and select Enter from the menu.
#MENU Enter {enter %word( %selline, %numwords( %selline))}
Reply with quote
xaosvilin
Novice


Joined: 08 Jun 2004
Posts: 36

PostPosted: Sun Jun 13, 2004 7:39 pm   
 
ahhh thanks so much. and if I wanted more manipulation verbs such as enter, i can use the alias code thats there and simply plug in a get or use or drink from and it should work correct? ah well i'll try it and let you know.
Reply with quote
xaosvilin
Novice


Joined: 08 Jun 2004
Posts: 36

PostPosted: Mon Jun 14, 2004 12:39 am   
 
wow it worked! but the oddest thing.. when i typed enter 1 clipper it would work perfectly. First clipper on the lists id would be spit out. however when i tried man o war it spit out the LAST manowar on the list. very strange. im wondering if its having trouble with multiple words? and it doesnt work for all items in the list. not sure why i'll continue to test it and give you some feedback. everyone on my mud is really excited about this!

(the admin wont do it for us.. the mean guy, youd think it would be easier for them to do it in the code itself)
Reply with quote
xaosvilin
Novice


Joined: 08 Jun 2004
Posts: 36

PostPosted: Sat Jun 19, 2004 11:00 pm   
 
Ok im an idiot. If anyone else is having trouble with this script, its probably because you're trying to manipulate the object in the game like you normally would.. 1 word keywords.. well the keywords taht get assigned the 1 2 or 3 in this instance is what shows up on the ids here are screen.. like get 1 thick candle.. instead of get 1 candle..

One more request for improvement. How could i make it so that it does this? (give/get/enter) 1 man o war TO (playername)
I know how to get the give get 1 man o war part, but then the words that come after.. how could I make that take my input.. like give 1 man o war to advocate and it still store the id etc and add in the TO advocate.
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