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


Joined: 01 Feb 2003
Posts: 15

PostPosted: Sun Feb 02, 2003 6:16 pm   

working with listed info
 
Hi, I want to grab info from a mud list and parse the list into assorted variables. Whats the best way to go about this? I'll give a sample and identify the pieces of information I'm looking for.


"sigil19878" a monolith sigil.
"Shinobu6992" Sister Shinobu.
"shrine544" a shrine of Iosyne.
"rat36067" an old rat.
"rat221" a young rat.
H:724 M:780 [eb]


What I'm looking for is to be able to access the names (an old rat) through a speed menu, and have it perform actions on the ID number (36067) for the selection I make.

Thanks for any ideas,
Gedron
Reply with quote
Kjata
GURU


Joined: 10 Oct 2000
Posts: 4379
Location: USA

PostPosted: Sun Feb 02, 2003 7:54 pm   
 
You want to store the name along with the ID so that you can look up the ID in the future in some script? Is that right?

Kjata
Reply with quote
LightBulb
MASTER


Joined: 28 Nov 2000
Posts: 4817
Location: USA

PostPosted: Sun Feb 02, 2003 8:02 pm   
 
#MENU {Buy %selword} {buy %replace( %word( %selline, 1), "~"", "")}
#MENU {Kill %selword} {kill %replace( %word( %selline, 1), "~"", "")}
#MENU {Get %selword} {get %replace( %word( %selline, 1), "~"", "")}

LightBulb
Advanced Member
Reply with quote
gedron
Beginner


Joined: 01 Feb 2003
Posts: 15

PostPosted: Sun Feb 02, 2003 8:09 pm   
 
well in this instance, the output is from an "info here" command which lists the items in the area including their specific id. I want to be able to provide the info to a speed menu for ease of selection. When I click on an item in the menu, I want the numeric information from the selection to be part of the command given. I.E. to get the specific item, or perhaps to attack it.
Reply with quote
LightBulb
MASTER


Joined: 28 Nov 2000
Posts: 4817
Location: USA

PostPosted: Mon Feb 03, 2003 2:14 am   
 
If I understand you correctly, you want a speed-menu that changes depending on what's in the room.

That is, when you do "info here" in one room, you'd like the speed menu to be:
a monolith sigil --> kill 19878
Sister Shinobu --> kill 6992
a shrine of Iosyne --> kill 544
an old rat --> kill 36067
a young rat --> kill 221

And then, in another room, after another "info here", you'd like the speed-menu to be:
a shrine of Twilight --> kick 692
an old rat --> kick 178
a rat --> kick 28012
a baby rat --> kick 13017
a personal journal --> kick 8912

That sounds great, but it will probably be an extremely complex script. If someone has ideas on how to do so I'm looking forward to seeing it.

On the other hand, the menu I suggested, while it won't list everything in the room, will allow you to right-click any item on the list already provided by the MUD, and then kill, get, or buy it. Additional/different commands should be obvious.

As for grabbing the info and putting it in variables, that's a fairly straightforward multi-line script:
#AL info {#VAR list %null;#T+ info;~info}
#TR {^~"%w(%d)~" (*)} {#ADDKEY list %1 %trim({%2})} info
#TR {^H:%d M:%d} {#T- list} list
This should give you a record-variable, @list, in which each item has a key-value pair, with the number as the key and the name as the value.

LightBulb
Advanced Member
Reply with quote
gedron
Beginner


Joined: 01 Feb 2003
Posts: 15

PostPosted: Mon Feb 03, 2003 5:15 am   
 
LightBulb,

That code does indeed fill the variable @list with all the info I'm wanting (this will probably not be a surprise to you ). but I'm afraid I don't understand how to reference the information in it. The help files don't appear to cover this kind of variable, or at least I couldn't find it.

----Edit Below----
Duh, I see what you were talking about now. I didn't understand exactly what your earlier code was doing, so it took me a while to catch on that the speed menu was referencing whatever my mouse pointer was over. That sould work for me, although I still would like to see if I can get it to work the other way.

I'm picturing having the speed menu with options for kill, get, examine, whatever as choices. Then a submenu offering the list of items to perform the function on. Maybe it won't be do-able, but it think it would be cool. Even if it had to be "hard coded" to show say 10 items in the speed menu sub-menu. That would cover 95% of the situations.
Reply with quote
gedron
Beginner


Joined: 01 Feb 2003
Posts: 15

PostPosted: Wed Feb 05, 2003 3:35 am   
 
Well, I got it to work the way I wanted it to and posted it in the completed scripts forum. I got really in depth in how it works, for the newbies to scripting, but the concept is actually not very complicated.

http://www.zuggsoft.com/forum/topic.asp?TOPIC_ID=10351&FORUM_ID=29&CAT_ID=1&Topic_Title=Dynamic+Speed+Menu&Forum_Title=Finished+MUD+Scripts

Thanks for the help LighBulb
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