Fetching item id's
Need a bit of help with this script. I want to take a list of item names from a text file then fetch there associated item id's from the database then output both the item names and item id's into a specific format as indicated below.
Code:
use DBI; |
Your request isn't really a quest related question. It is more of a general perl or scripting question. I am sure it can be done easy enough how you are wanting to do it.
You could probably just save yourself some time and use notepad++ to edit your item name list into queries for the item id SELECT. Then, do the same to make the results into queries to insert into the loot tables. You can hold ALT then click and drag up or down to select a column to type in for all rows selected. This means you can select the row in front of your column of item names, and type: Code:
SELECT * FROM items WHERE `name`=" Code:
"); Next, select the radio button for "Run until the end of file" and click Run. That should make all lines look like a query. Sometimes you might get a weird character when you run macros, but you can just do a find/replace on that character to remove it if needed. At that point, you can just run your queries from that list and do the same again with the query results. Once you get used to using notepad++, stuff like that gets really quick and easy to do. Otherwise, if you are set on getting the script working, here is an example plugin I use on my server to query the DB. Should be able to use it to figure out what you are wanting: Code:
# Usage: plugin::SetCharVarByName(CharName, VarName, VarValue); |
Didn't know where exactly to post this question as it doesn't really fit anywhere. I'll give the notepad++ thing a try. Looking up one hundred plus item id numbers manually is not exactly fun so I was attempting to automate it.
|
Well notepad++ is an interesting program with lots of potential uses but for what I am doing I think i can create loottables just as fast without it.
I took the script segment trevius posted and started trying to adapt it to what I was working on. While I have made some progress I am still unable to get the id to transfer through. Here is where I am at now Code:
#Item id look up by item name |
You should probably read the docs for DBI. http://www.perl.com/pub/1999/10/DBI.html
|
Heh naturally I figured most of it out not long after my last post. Thanks for the help trevius and thanks for the link lerxst2112 maybe that will help in finding out why the script doesn't like ' in item names. Easy one to work around though.
|
All times are GMT -4. The time now is 04:19 PM. |
Powered by vBulletin®, Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.