Item Desc overhaul and OCD Inv helper

Paragon

Member
<Sorry wrong forum.>
UPDATED: 23April2011
I like Bales OCD_Inventory but didn't like the configuration method.
Using this set of relay scripts and ash files the following changes will occur to your item_desc.php
The mallprice of the item will be shown. (updated at most once per day.)
Also a summary of any OCD command associated with the item will be shown.
A list of tags associated with an item is added.
A link will be added to edit item info.
Clicking the new link will open a new window that will allow you edit the OCD command associated with the item and the tags associated with the items

In addition a script InvByTag.ash is included which will list items in your inventory that are associated with a specific tag.

Tags are Global, I.E if I add a tag to an item you will see that item tagged that way and vice versa

Requirements: relay_OCD_dB_Manager.ash

Installation:
relay/
desc_item.ash
editItemInfo.ash
scripts/
PulveriseInfo.ash;
KolMafiaSql.ash;
InvByTags.ash

daggerScreenShot.png

wonderwallScreenShot.png

EditItemScreenShot.png




Notes: In addition to editing the OCD command of an item it is a test of KolMafiaSql.ash, therefore sometimes when you click on an item you will notice "Item added to database, Thanks". The information added to the database is simply the item id, name,and any img urls. No information about OCD or your character is collected.
Also, my sql server is a free remote server so I can not vouche for it's stability yet.

Further Notes: The SqlServer is in no way secure. As I have decided to allow the user kolmafia logs in with the ability to add/drop/alter tables insert/delete/select rows, basicly full admin access.

ChangeLog:

23apr11.2:Updated pulverize information.
23apr11: Updated to work with newer version of OCD, added ability to add/remove tags from items.
11jan11: Updated to fix alot of init problems.
9jan11: Initial Upload
 

Attachments

  • KolMafiaSql.ash
    2.2 KB · Views: 76
  • editItemInfo.ash
    4 KB · Views: 71
  • InvByTags.ash
    1.1 KB · Views: 72
  • desc_item.ash
    4.4 KB · Views: 78
  • pulveriseResults.ash
    5 KB · Views: 73
Last edited:

Bale

Minion
desc_item is cool! Awesome plug-in for OCD. I endorse this product.

Just one question? Isn't relay_editItemInfo supposed to do something? It does not work for me.
 

Paragon

Member
Clicking on the link should change the window the item_desc was in to a new window that displays the item in the item_desc page's configuaration line as it would be shown in the relay_db_manager. Clicking the button below this should submit to it's self and if you changed any of the OCD command parameters they should now be saved in the OCD mapfile.

If this isn't working, please check if mafia is giving any errors. If mafia is not giving any errors then would it be possible for if(!load_OCD()) exit; to have caused the exit? Finally, it could have been a connection issue of some kind with the sql server. I have found that Sometimes a window will popup like normal(w/o the override script) because of an error, then after hitting f5, or closing and reopening it works. I have tested it using chrome and firefox).
 

Bale

Minion
I see. I was expecting that relay_editItemInfo would do something if I selected it from the drop-down in the top menu. That's the only reason to start the filename with "relay_". I'd suggest that you change the file name so that it no longer appears as a bogus entry in the menu.
 

Winterbay

Active member
There appears to be an error with the pulverise-info. It seems to be setting "cannot be pulverised" on everything.

Case in point, the didgeridooka:
Code:
didgeridooka

    This is an ancient aboriginal musical instrument, which was first co-opted by hippies and then converted into a two-handed, shoulder-mounted projectile launcher. And you think you've got it bad?

    You'll have to practice your circular breathing if you're going to use this properly, 'cause, dude, those aborigines totally used circular breathing and you can't get the soul of it unless you circular breathe.

    Type: ranged weapon (2-handed blowgun)
    Power: 180
    Moxie Required: 75
    Selling Price: 165 Meat.

    Enchantment:
    Moxie +9

Mallprice:980
Item can not be Pulverised.
Keep 1, and PULV the rest.
Tags :
Edit Item Info.
Item added to database, thanks.
 

AlbinoRhino

Active member
There appears to be an error with the pulverise-info. It seems to be setting "cannot be pulverised" on everything.

Same here. Every single item description seems to have the line "Item can not be Pulverised."

I am loving the easy ability to determine what to autosell and what is worth putting in the mall.
 

Winterbay

Active member
Doing some testing leads to construction of the following URL for item_id 2031 (didgeridooka):
Code:
http://paragon.net84.net/Kol/KolMafiaSqlAjax.php?Action=select+*+from+CORE_Item2Wads+where+item_id=2031

That seems to be what the script uses with visit_url. The response is "Invalid query: Query was empty" when used in FF and when used with visit_url is completely blank.

This is where my skills leave me unable to continue :)
 

Theraze

Active member
It's possible that the php file being called (on the server) isn't the right one... you get that same response if you just open it without the Action call.
 

Paragon

Member
Register globals is off on the server side php script and it gets the information from the post method rather then the get method, using a direct url in FF or any other browser will always result in no query unless there is a form submitting the request. The best way to see what the php script is really responding to kolmafia with is to uncomment the line that prints the unmodified result. I will look into the problem later today.
 

Winterbay

Active member
I tried the visit_url-version in the script as well, with both the get and post methods and it gave absolutely no response...
 

Paragon

Member
Yea, I just got home and tried it. The sql server is having issues. I guess 99% uptime doesn't take into accoutn "Working uptime" vs "nonresponsive uptime". The web server is running fine, but it seems the sql servers are down.
 

Winterbay

Active member
Interesting error today: Opened up a photocopied monster from the fax machine and received the following print out in the CLI:
Code:
Array index out of bounds (KolMafiaSql.ash, line 17)

No idea why :)

Edit: The server appears to be down, which would definitely explain why the response is weird.
 
Last edited:

Paragon

Member
The files have been update... things should work now. Also, I made changes so that using a url directly will trigger the script (Using both post, and get). The new files are necessary as breaking changes to the php script have been made. Sorry about the confusion.
 

EdFox

Member
For this to work one must go into the Mafia preferences, Browser, and uncheck "Check wiki for item descriptions".
I had no idea why I wasn't getting anything other than the usual wiki tab when I clicked an item picture and the script will throw an error: Begin index -1 out of bounds (desc_item.ash, line 37)

May I suggest adding this to the first post to assist others.
A message from the script other than an error when this happens would be great.
Finally, please add a link to the wiki page for the item somewhere on the item_desc popup.
Thanks.
 

AlbinoRhino

Active member
Is this supposed to be writing tons of code to the CLI whenever an item description is clicked ?

For example:

select * from CORE_Item2Wads where item_id=2093
http://paragon.net84.net/Kol/KolMaf...tem2Wads+where+item_id=2093&HEADERS=1&QUERY=1
item_id,result_type,count_min,count_max,special,<br>2093,1,8,10,,<br>EOF
creates 8 to 10 twinkly powders
select tag_name from CORE_Tags tags join CORE_Items2Tags i2t on tags.tag_id=i2t.tag_id where i2t.item_id=2093
http://paragon.net84.net/Kol/KolMaf..._id++where+i2t.item_id=2093&HEADERS=1&QUERY=1
EOF
insert into CORE_Items (item_id, item_name, item_kol_img) values (2093, 'hors d'oeuvre tray','http://images.kingdomofloathing.com/itemimages/trayshield.gif')
http://paragon.net84.net/Kol/KolMaf...domofloathing.com/itemimages/trayshield.gif')
false
select * from CORE_Item2Wads where item_id=2178
http://paragon.net84.net/Kol/KolMaf...tem2Wads+where+item_id=2178&HEADERS=1&QUERY=1
item_id,result_type,count_min,count_max,special,<br>2178,63,1,1,,<br>EOF
creates 1 twinkly or <font color='red'>hot</font> or <font color='blue'>cold</font> or <font color='gray'>spooky</font> or <font color='green'> stench</font> or <font color='blueviolet'>sleeze</font> powder
select tag_name from CORE_Tags tags join CORE_Items2Tags i2t on tags.tag_id=i2t.tag_id where i2t.item_id=2178
http://paragon.net84.net/Kol/KolMaf..._id++where+i2t.item_id=2178&HEADERS=1&QUERY=1
EOF

Also, it gives all pulverize information in terms of powders i.e. no nuggets or wads ?
 
Last edited:

Bale

Minion
By the way, this script works perfectly if you put all the files in your /relay directory. That might make the directions in the first post a teeny bit simpler and avoid cluttering the script menu. :)
 

Bale

Minion
Sadly, this script is going to be broken when I release my next version of OCD Inventory. To prevent that you can make these changes.

In desc_item you'll need to replace these lines:
Code:
		string OCDfile = "OCD_"+my_name()+"_Data.txt";
		file_to_map(OCDfile,OCD);

with:

Code:
		if((!file_to_map("OCDdata_"+vars["BaleOCD_DataFile"]+".txt", OCD) || count(OCD) == 0))
			file_to_map("OCD_"+my_name()+"_Data.txt",OCD);

Then near the beginning of editItemInfo.ash you'll need

Code:
setvar("BaleOCD_DataFile", my_name());

And you'll need to replace line 50 of editItemInfo with:

Code:
		if((!file_to_map("OCDdata_"+vars["BaleOCD_DataFile"]+".txt", OCD) || count(OCD) == 0)) 
			file_to_map("OCD_"+my_name()+"_Data.txt",OCD);


If you do that this script will switch over from handling my current version to my next version without the user ever seeing an error.
 
Last edited:

Winterbay

Active member
The script gives a rather funny output for items you have set to "Keep All":
Code:
Keep 0, and KEEP the rest.

ETA: @bale: Will that break the script before you make the changes or will it work before and after?
 

Bale

Minion
ETA: @bale: Will that break the script before you make the changes or will it work before and after?

Before and after. He won't need the setvar later on since he imports my script.

Come to think of it, editItemInfo should have the setvar, not desc_item and I might have caused a conflict with a variable name from importing my script. I'll make those fixes to my earlier post!
 
Last edited:
Top