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


Joined: 23 May 2001
Posts: 68
Location: Sweden

PostPosted: Sun Jun 30, 2002 2:03 am   

Reagent script
 
Hi everyone,

Buying and stocking up reagents in Moongate can be rather tedious and time-consuming and therefor I want to create a script that complete automates the process in terms of:

1. Calculating how many reagents that need to be bought.

2. Buying the correct reagents and putting them in the bags.

DETAILS
Let's assume there are two types of reagents: Water and Fire. There exist many different water and fire reagents, se below:

Water -> fish scale, snow drop
Fire -> pinch of sulfur, fire ant

There also exists many types of reagents shops:

Rune Magic shop only sells pinch of sulfur and fish scales while Yew Magic Shop sells fire ants and snow drops.

I have two bags, one each for fire and water reagents.

AUTOMATION
When I run the script I want the script to look in bag 1 (fire reagents) and bag 2 (water reagents) and check how many reagents there exist in each bag (which can hold maximum 100 reagents).

If there exist 10 fire ants and 20 pinch of sulfurs I want the script to buy 70 fire reagents from the shop.

In bag2 I have 80 fish scales, so it can hold another 20 water reagents.

HOW TO BUY FROM SHOP
Each item in shop is numbered like this:
1) A wand of frost
2) A summoning stone
3) A fire ant
4) A snow drop

So, this particular shop only sells fire ants and snow drops.

One more problem
I can only buy 20 reagents at the time (limits on number of items in my inventory) so I want the script to execute following:

Shop buy 20 3;put all.fire bag1
Shop buy 20 3;put all.fire bag1
Shop buy 20 3;put all.fire bag1
Shop buy 10 3;put all.fire bag1
Shop buy 20 4;put all.snow bag2

HOW?
I guess I need to define, in the script that:
1) bag1 is for fire reagents
2) bag2 is for water reagents

3) Types of fire reagents (sulfur and fire ants)
4) Types of water reagents (fisch scale and snow drops)

Any ideas on how to achieve this? :>

/N00b scripter
 
 
Reply with quote
nostra
Wanderer


Joined: 23 May 2001
Posts: 68
Location: Sweden

PostPosted: Sun Jun 30, 2002 2:09 am   
 
I forgot to mention how the content in a bag is presented.
BAG 1
A gnomish miners bag contains:
a small dagger
(10) fire ants
(10) sulfur pinch

BAG 2
A gnomish miners bag contains:
a small smoke bomb
(80) a shimmering white fish scale
Reply with quote
LightBulb
MASTER


Joined: 28 Nov 2000
Posts: 4817
Location: USA

PostPosted: Fri Jul 05, 2002 12:29 pm   
 
You've probably noticed that nobody is in any hurry to write this for you. Most people are happy to provide short scripts for simple tasks. Long, involved scripts for complex tasks are usually written by the person most interested in having them (that would be you).

I'd suggest that you do this a bit differently. First of all, instead of trying to automate the entire process, automate portions of it first. After you have working solutions, you may be able to string them together.

Instead of trying to look in the bag and count how many of each type reagent are in it, keep count as you go along.
#TR {You put (%d) fish scales in BAG 1} {#ADD Bag1Water %1}
#TR {You get (%d) fish scales from BAG 1} {#ADD Bag1Water -%1}
Get bags with different names, if possible (both of yours seem to be gnomish miners bags).
Don't put other things in them (a small dagger, a small smokebomb). Get a third bag for other stuff.

For the shops, you can catch the numbers for the elements in variables when you list what the shop has.
#AL list {#VAR storefire 0;#VAR storewater 0;~list}
#TR {^%d~) A fish scale} {#VAR storewater %1#VAR watername fish}
#TR {^%d~) A snow drop} {#VAR storewater %1;#VAR watername snow}
#TR {^%d~) A fire ant} {#VAR storefire %1;#VAR firename fire}
#TR {^%d~) A pinch of sulfur;#VAR firename sulfur} {#VAR storefire %1}
If a store has more than one element of the same type, this will catch the one with the highest number.
These numbers can then be used to buy the elements
#AL buywater {#IF (@storewater) {#IF (100 - @bag1water > 20) {shop buy 20 @storewater) bag1} {shop buy %eval(100 - @bag1water)};put all.%eval(@watername} {#SAY Out of stock}

That should get you started, good luck.

LightBulb
Senior Member
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