Jump to content
  • 0

Script Command For Checking Item Types?


Question

4 answers to this question

Recommended Posts

  • 1
Posted

like this ?

prontera,155,181,5	script	Sample	757,{
getinventorylist;
while( .@i < @inventorylist_count ){
	if( getiteminfo( @inventorylist_id[.@i],2 ) == 3 ){
		.@item_id[.@found] = @inventorylist_id[.@i];
		.@found++;
		.@menu$ = .@menu$ + getitemname( @inventorylist_id[.@i] ) +":";
	}
	.@i++;
}
if( .@found ){
	.@i = select( .@menu$ ) - 1;
	mes "You selected "+getitemname( .@item_id[.@i] );
}else{
	mes "No items.";
}
close;
}
  • Upvote 1
Posted

Quoted from script_commands.txt

 

*getiteminfo(<item ID>,<type>)

This function will look up the item with the specified ID number in the database
and return the info set by TYPE argument.
It will return -1 if there is no such item.

Valid types are:
    0 - Buy Price; 1 - Sell Price; 2 - Item Type;
    3 - maxchance (max drop chance of this item, e.g. 1 = 0.01%)
        if = 0, then monsters don't drop it at all (rare or a quest item)
        if = 10000, then this item is sold in NPC shops only
    4 - sex; 5 - equip; 6 - weight; 7 - atk; 8 - def; 9 - range;
    10 - slot; 11 - look; 12 - elv; 13 - wlv; 14 - view id (from 'db/item_avail.txt')
    
    If RENEWAL is defined, 15 - matk

See the sample in 'doc/sample/getiteminfo.txt'.
Posted (edited)

Thanks for the reply. I guess I need to be a bit more specific. I wrote a very nice enchantment script which I want to enchant only etc type items. It works good if I specify a range of items, but since there are so many spread out places that contain etc items I need it to check if the item is an etc item in the players inventory instead. For example if the player has 12 etc items and 6 weapons in there inventory. I want it to only show the 12 etc items in the list of options to choose from.

Peopleperson49

I currently use this:

mes "["+getarg(0)+"]";mes "Which charm do you want to upgrade with?";set .@CharmMenu$,"";for(set .@i,22001; .@i<=22043; set .@i,.@i+1) { if(countitem(.@i)>0) { set .@CharmMenu$,.@CharmMenu$+""+getitemname(.@i)+""; } else { set .@CharmMenu$,.@CharmMenu$+":"; } }set .@CharmType,select(.@CharmMenu$);set .@CharmType,.@CharmType+22000;mes ""+.@CharmType+"";
Edited by Peopleperson49

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.   Paste as plain text instead

  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.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...