Jump to content
  • 0

Get item value [Need Help]


rap

Question


  • Group:  Members
  • Topic Count:  1
  • Topics Per Day:  0.00
  • Content Count:  2
  • Reputation:   0
  • Joined:  07/16/15
  • Last Seen:  

Hi, guys! Im kinda new in scripting. I just want to ask how do i get the value of an item in a player's inventory.

 

ex. I want to get how many apples do I have in my inventory? And use its value in an IF statement? (SOLVED)

 

next question, How do i get the value of an input variable to be used in a getitem command?

Edited by rap
Link to comment
Share on other sites

3 answers to this question

Recommended Posts


  • Group:  Members
  • Topic Count:  81
  • Topics Per Day:  0.02
  • Content Count:  1654
  • Reputation:   583
  • Joined:  08/09/12
  • Last Seen:  


case 4: // Convert Badges

mes "[Erundek]";

mes "[So you want to convert your badges to War Badge, huh?]";

next;

menu "Bravery Badges to War Badge",bbadge,"Valor Badges to War Badge",vbadge;

bbadge:

mes "Input the number of badges you want to convert:";

next;

input .@bdg;

if (.@bdg >= countitem(7828)) {

getitem 7773, .@bdg;

delitem 7828, .@bdg;

mes "Done!";

} else {

mes "You have insufficient badges";

}

close;

vbadge:

mes "Input the number of badges you want to convert:";

next;

input .@bdg;

if (.@bdg >= countitem(7829)) {

getitem 7773, .@bdg;

delitem 7829, .@bdg;

mes "Done!";

} else {

mes "You have insufficient badges";

}

close;

Link to comment
Share on other sites


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

count amount of item  use countitem

if ( countitem( 512 ) < 10 ) {
     // you have less than 10 apples.
}

get value of input ...

input .@value;
mes "Your input is : "+.@value;
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  1
  • Topics Per Day:  0.00
  • Content Count:  2
  • Reputation:   0
  • Joined:  07/16/15
  • Last Seen:  

 

count amount of item  use countitem

if ( countitem( 512 ) < 10 ) {
     // you have less than 10 apples.
}

get value of input ...

input .@value;
mes "Your input is : "+.@value;

 

 

What i mean is if I want to use getitem and i want to use the value from a previous inputted value how do I do it? Can you correct this for me? Thanks in advance! ^^

case 4: // Convert Badges
mes "[Erundek]";
mes "[so you want to convert your badges to War Badge, huh?]";
menu "Bravery Badges to War Badge",bbadge,"Valor Badges to War Badge",vbadge;
 
bbadge;
mes "Input the number of badges you want to convert:";
input .@bdg;
@count1 = countitem(7828);
if (.@bdg >= .@count1) { getitem 7773,  .@bdg; @delitem 7828, .@bdg;}
close;
else {mes "You have insufficient badges"; }
close;
end;
 
vbadge;
mes "Input the number of badges you want to convert:";
intput .@bdg;
@count1 = countitem(7829);
if (.@bdg >= .@count1) { getitem 7773,  .@bdg; @delitem 7829, .@bdg;}
close;
else {mes "You have insufficient badges"; }
close;
end;
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...