Jump to content
  • 0
Sign in to follow this  
Helena

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

Question

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. ^^

 

 

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; }
Edited by Helena

Share this post


Link to post
Share on other sites

3 answers to this question

Recommended Posts

  • 0

I think something like this:

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; }
Edited by Garr

Share this post


Link to post
Share on other sites
  • 0

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! :)

Edited by Helena

Share this post


Link to post
Share on other sites
  • 0

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]

Edited by Garr

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
Sign in to follow this  

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.