Item Managment & Text Reference

So I am working on a script, I would like to be able to dynamically decide which items in my inventory to autosell, which to place in mall, which to put in the clan stash, etc... I know a lot of people around here can do stuff like this by creating a text document with all the information in it and then use the file_to_map() function to map out the data. But how exactly do you do this? I want to make one with a data-structure like so,
Code:
[TYPE]	[KEEP]	[ITEM]
sale	0	Knob Goblin Sausage
mall	1	beer basted brat
stash	1	7-ball
Sale = autosell
mall = place in mall and undercut
stash = place in clan stash

The "keep" refers to how many to keep available in your inventory (item_amount() - "keep value")
so the 1 means keep 1 available, 0 means keep 0, etc. Item is simly the item name.

This structure would make it easily customizable by the user. And would then be able yo be used in many other scripts as well.
And the way i vision it, you would be able to call a function that is something like,
manage_items("sale"); #autosell all items marked as "sale"
manage_items("stash"); #place all "stash" items in the clan stash
manage_items("mall"); #place all items marked as "mall" in the mall and undercut.

So could someone tell me how to do this? (examples would be extremely helpful!)

Thanks!
 

hippymon

Member
To my own complete amazement after about 2 hours of experimenting :p I was able to come up with the attached script.

With that, the format of the map should be as follows (which is pretty much the same as what you desired):
Code:
[ACTION]	[KEEP]	[ITEM]
sale	0	Knob Goblin Sausage
mall	1	beer basted brat
stash	1	7-ball
P.S. Map must be "tab space" separated...

EDIT: Updated script, function is now "manage_items( string action )"
 

Attachments

  • itemlist.txt
    4.2 KB · Views: 147

fewyn

Administrator
Staff member
[quote author=hippymon link=topic=1282.msg6263#msg6263 date=1197174896]
To my own complete amazement after about 2 hours of experimenting :p I was able to come up with the attached script.

With that, the format of the map should be as follows (which is pretty much the same as what you desired):
Code:
[ACTION]	[KEEP]	[ITEM]
sale	0	Knob Goblin Sausage
mall	1	beer basted brat
stash	1	7-ball

[/quote]

Awe :( what build did you create this for? I'm getting debug errors and it's not loading the map file. (5355)

Attached is the item_list.txt and debug log incase interested.
 

Attachments

  • item_list.txt
    4 KB · Views: 192
  • DEBUG_20071209.txt
    2.5 KB · Views: 44

hippymon

Member
It is because I had the script set to file name item_list.txt but attached itemlist.txt..... :|
My bad, lol.. Just for the record I use the main builds, 11.8 currently.

EDIT: Oh, I guess it would have helped to look at your map file... :p I see the problem now, there should be a tab between each variable... I have uploaded a copy of your map which will work... In other words instead of:
stash 0 twinkly nuggets
It should be:
stash 0 twinkly nuggets
Notice the tabs...
 

fewyn

Administrator
Staff member
[quote author=hippymon link=topic=1282.msg6267#msg6267 date=1197240322]
It is because I had the script set to file name item_list.txt but attached itemlist.txt..... :|
My bad, lol.. Just for the record I use the main builds, 11.8 currently.
[/quote]

That's strange though... I noticed that and fixed it so my map was an item_list.txt (as I uploaded) and I'm getting the same
Code:
Unexpected error, debug log printed.
Map load failed.
in both the latest build and 11.8 >_>
 
Top