Jump to content
  • 0

Script Command For Checking Item Types?


Peopleperson49

Question


  • Group:  Members
  • Topic Count:  218
  • Topics Per Day:  0.05
  • Content Count:  1180
  • Reputation:   141
  • Joined:  01/27/12
  • Last Seen:  

I'm looking for a script command that allows the script to check and see if an item is an etc type. I thought there was something of the sort, but I can't seem to figure out what that was. Thanks.

 

Peopleperson49

Link to comment
Share on other sites

4 answers to this question

Recommended Posts

  • 1

  • Group:  Forum Moderator
  • Topic Count:  93
  • Topics Per Day:  0.02
  • Content Count:  10015
  • Reputation:   2350
  • Joined:  10/28/11
  • Last Seen:  

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
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  17
  • Topics Per Day:  0.00
  • Content Count:  754
  • Reputation:   186
  • Joined:  05/22/12
  • Last Seen:  

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'.
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  218
  • Topics Per Day:  0.05
  • Content Count:  1180
  • Reputation:   141
  • Joined:  01/27/12
  • Last Seen:  

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
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  218
  • Topics Per Day:  0.05
  • Content Count:  1180
  • Reputation:   141
  • Joined:  01/27/12
  • Last Seen:  

Thanks Emistry for the suggestion. I had already tried this way before, but never could seem to get it right. Your idea worked quite nicely for what I needed.

 

Peopleperson49

Link to comment
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.   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.

×
×
  • Create New...