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


Joined: 01 Jul 2002
Posts: 81
Location: USA

PostPosted: Sat Dec 18, 2004 6:48 pm   

Loot and sell script help please
 
I would like to make a script that stores items I loot into a variable string.

When I get to a shop I would like to then sell the items in the string and reset the string.

I am not sure where to begin.

Here is the output from the mud when I loot a corpse:

You stripped the bloody head of a hideous mud stalker.
You stripped some bluish-green slimy lakeweed.
You stripped a scratched bronze pendant.
You stripped a bright red cherry.
You stripped 22 silver coins.
You strip the corpse, its items fall onto the ground!
The corpse fades away into dust.



I would like to write a script to pick the items up and somehow get them into a variable. There are a few items on corpses I don't want to pick up so I would like a check to make sure they aren't taken. There are some items I don't want to sell, also, like the silver coins and the bloody head. Not sure how to make it check for that.

Any help or suggestions are appreciated.

Thanks!
Reply with quote
Hibio
Beginner


Joined: 19 Mar 2004
Posts: 22

PostPosted: Mon Dec 27, 2004 9:50 pm   
 
Make a string with items you are going to pick up, do a loop through the string to pick up the items - this might look kind of messy on your mud session screen but less time to crate than the other option

If you want it nice and clean, create a database with monsters and items matching the monsters, and loop through that


As for selling, make a string with the items you want to sell, and loop through it - again, kind of messy

And of course again, if you want to see it nice and neat, use the database and tag the item if you picked up or not and make a loop that will only sell the items you picked up that match your 'items to sell' string
Reply with quote
parrotslave
Wanderer


Joined: 01 Jul 2002
Posts: 81
Location: USA

PostPosted: Tue Dec 28, 2004 5:15 am   
 
I made some triggers to send things into a string list variable then sell them using #forall:

#forall @sell {sell %i}
#forall @sell {#var sell %delitem( %i, @sell)}

This works if there are only a few things, but if there are too mank it spams the mud with the entire list at once and boots me.

Where would I insert #alarm +2 into the line to allow a 2 second pause between items sold?

Thank you for your help.
Reply with quote
Hibio
Beginner


Joined: 19 Mar 2004
Posts: 22

PostPosted: Tue Dec 28, 2004 5:44 am   
 
try

#forall @sell {#var sell %delitem( %i, @sell);#wait 2000}

a wait 2 seconds after each sell
Reply with quote
Vorax
Apprentice


Joined: 29 Jun 2001
Posts: 198
Location: USA

PostPosted: Wed Dec 29, 2004 2:23 am   
 
It might be better to use %pop() to sell the items, that way once the item is sold, it is also removed from the list.
#LOOP %numitems(@sell) {sell %pop(@sell);#WAIT 2000}
or
#UNTIL (!%numitems(@sell)) {sell %pop(@sell);#WAIT 2000}
or
#WHILE (%numitems(@sell)) {sell %pop(@sell);#WAIT 2000}
Reply with quote
Falan
Wanderer


Joined: 17 Aug 2004
Posts: 98
Location: OK, USA

PostPosted: Wed Dec 29, 2004 5:17 am   
 
%delitem does delete it from the list.

#ALIAS sitems {#FORALL @sell {sell %i;#VAR sell %delitem(%i,@sell);#WAIT 2000}}

#BUTTON 99 {Sell} {sitems}

I think you can combine the #FORALLs, and there's a nice button so you don't have to type the alias (if the sell isn't made off a trigger, that is). But, either way; just different shades of the same color. Cool
_________________
zMUD 7.05a
Reply with quote
parrotslave
Wanderer


Joined: 01 Jul 2002
Posts: 81
Location: USA

PostPosted: Wed Dec 29, 2004 10:38 pm   
 
Thanks for all the help.

Wish there was a help file for stringlists that listed all the commands and functions you can use with them. It has been difficult hunting through all the commands and functions to find which ones work with stringlists.
Reply with quote
Vorax
Apprentice


Joined: 29 Jun 2001
Posts: 198
Location: USA

PostPosted: Thu Dec 30, 2004 1:55 am   
 
Check the Function Reference (predefined functions) in the help file. Functions you can use for lists are, ironicly, listed under the topic of "Lists".
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