in-game item_db function. Is this possible to add?

Helena

New member
Messages
238
Points
0
Emulator
rAthena
Hello,

I am using an item with a callfunc attached to it, it is like a in-game database system. Its really simply but I like the way it turned out.

Sadly there are 2 problems.

1) It searches for japanese name, this is how i want it but if the item does not exist the search box still appears but with all values set to zero. I know a check can be easily be done if i make it search for ID but is it also possible with name?

2) It only shows one result but in RO there are several items with the same name. Take Flapping Angel Wing for example, there are two of those but only one shows up. Is there a way to make all options show in the dialogue?

Sorry if this is a impossible script but thanks so much for trying nonetheless. ^^

Code:
L_Item:next;dispbottom "Initiating Item Database...";progressbar "0xRRGGBB",2;mes "Database successfully loaded. What Item do you want to learn about?:";mes " ";mes "Please ^ff0000only input the Item's full name^000000 or there will be incorrect results!";input .@itemname$;query_sql "SELECT ID, price_buy, price_sell, weight, atk, defence, slots FROM item_db WHERE name_japanese = '"+ escape_sql(.@itemname$) +"'", @iid$, .@buy, .@sell, .@weight, .@atk, .@defence, .@slots;		if(getiteminfo(.@itemnum, 0) == -1)    // item does not exist	next;	mes "Name: "+.@itemname$;	mes "Weight: "+.@weight;	mes "ATK: "+.@atk;	 mes "DEF: "+.@defence;	mes "Slots: "+.@slots;	mes "Buying Price: "+.@buy;	mes "Selling Price: "+.@sell;	next;	goto L_menu2; L_menu2:menu "Which monster drops it?",-,"Search for another item",L_Item,"Exit",L_later2; atcommand "@whodrops "+@iid$;goto L_menu2; L_later2:	close; }
 
Last edited by a moderator:
I think something like this:

Code:
L_Item:	next;	dispbottom "Initiating Item Database...";	progressbar "0xRRGGBB",2;	mes "Database successfully loaded. What Item do you want to learn about?:";	mes " ";	mes "Please ^ff0000only input the Item's full name^000000 or there will be incorrect results!";	input .@itemname$;	.@amount = query_sql ("SELECT ID, price_buy, price_sell, weight, atk, defence, slots FROM item_db WHERE name_japanese = '"+ escape_sql(.@itemname$) +"'", @iid$, .@buy, .@sell, .@weight, .@atk, .@defence, .@slots);        	if (.@amount == 0) { //No items found		mes "There's no such item.";		next;		menu "Search for another item",L_Item,"Exit",L_later2;	}	for (.@i = 0; .@i < .@amount; .@i++) {			next;			mes "Name: "+.@itemname$;			mes "Weight: "+.@weight[.@i];			mes "ATK: "+.@atk[.@i]; 			mes "DEF: "+.@defence[.@i];			mes "Slots: "+.@slots[.@i];			mes "Buying Price: "+.@buy[.@i];			mes "Selling Price: "+.@sell[.@i];		}		next;		goto L_menu2;	 L_menu2:	menu "Which monster drops it?",-,"Search for another item",L_Item,"Exit",L_later2;	atcommand "@whodrops "+@iid$;	goto L_menu2;	L_later2:	close; }
 
Last edited by a moderator:
For some reason my browser crashes when quoting, but that works nicely Garr !

The only thing that doesn't change along is the name. Example when i type in Ice Pick, the first page shows fine but after clicking 'next' it doesnt display a name (all other info is present though).

What can I do to fix that? Thanks!

Nevermind, solved it by changing the  "Name: "+.@itemname$[.@i];" into "Name: "+.@itemname$;"

Thank you so much, Garr!
default_smile.png


 
Last edited by a moderator:
Yeah, my bad, I completely forgot that it's not part of sql query ^^'

Also, for now this will only show @whodrops for first item in the list.

I'm not sure how you'd like to deal with it, to show chosen item? (Make it like next/previous menu along with whodrops option)

Or leave as is, where it shows only first item found?

[Edited code in my first post with your fix]

 
Last edited by a moderator:
Back
Top