Jump to content
  • 0

HELP in @item npc script


Lord Ganja

Question


  • Group:  Members
  • Topic Count:  141
  • Topics Per Day:  0.03
  • Content Count:  444
  • Reputation:   22
  • Joined:  06/18/12
  • Last Seen:  

Hello, please help me with this. What script should I use in order for the npc to close whenever the input # is '0' or 'null'.
and whenever they input an ITEM ID which is NOT in the database it will say "Invalid Item ID"..
 
Thanks in advance..
 
Here's my script:
prontera,142,172,5    script    Item Giver    106,{
mes "[Item Giver]";
mes "Please input the ITEM NUMBER that you want to receive.";
mes " ";
mes "You could use @ii <item name> to look for it or browse at ratemyserver.net";
input .@itemnum;
next;
mes "[Item Giver]";
mes "How many pieces of this item do you want to receive?";
input .@itemcount;
next;
mes "[Item Giver]";
mes "Here you go! Come again!";
getitem .@itemnum,.@itemcount;
close;
end;
}

 

 

Edited by Lord Ganja
Link to comment
Share on other sites

4 answers to this question

Recommended Posts


  • Group:  Members
  • Topic Count:  22
  • Topics Per Day:  0.00
  • Content Count:  764
  • Reputation:   220
  • Joined:  11/14/11
  • Last Seen:  

Therefor you can use the getiteminfo command.

if(getiteminfo(.@itemnum, 0) == -1)
    // item does not exist
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  22
  • Topics Per Day:  0.00
  • Content Count:  764
  • Reputation:   220
  • Joined:  11/14/11
  • Last Seen:  

Because the variables you are using to store the input values  are integer the input will never be "null"; it's always a number.
To answer your question with an example:

input .@itemnum;
if (.@itemnum == 0)
    close;
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  141
  • Topics Per Day:  0.03
  • Content Count:  444
  • Reputation:   22
  • Joined:  06/18/12
  • Last Seen:  

Because the variables you are using to store the input values  are integer the input will never be "null"; it's always a number.

To answer your question with an example:

input .@itemnum;
if (.@itemnum == 0)
    close;

Thanks for the reply. But how about the item id which is not in the itemdb?

 

EDIT:

 

Nevermind, I already solved it. thanks anyway.

Edited by Lord Ganja
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  141
  • Topics Per Day:  0.03
  • Content Count:  444
  • Reputation:   22
  • Joined:  06/18/12
  • Last Seen:  

Therefor you can use the getiteminfo command.

if(getiteminfo(.@itemnum, 0) == -1)
    // item does not exist

 Thanks again! :D

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