Adding to Bag - Help

  • Welcome to skUnity!

    Welcome to skUnity! This is a forum where members of the Skript community can communicate and interact. Skript Resource Creators can post their Resources for all to see and use.

    If you haven't done so already, feel free to join our official Discord server to expand your level of interaction with the comminuty!

    Now, what are you waiting for? Join the community now!

  • LOOKING FOR A VERSION OF SKRIPT?

    You can always check out skUnity Downloads for downloads and any other information about Skript!

Status
Not open for further replies.

BaranHan

Member
Oct 22, 2017
3
0
0
24
Guys I'm trying to convert an item to a variable. Can someone help me? I know the wrong parts. What should i set to these wrong parts?

command /addtomybag [<text>] [<int>]:
-trigger:
--if arg-1 is "coin":
---if arg-2 is set:
----if player has arg-2 gold nugget named "&eCoin" in inventory:
-----remove arg-2 gold nugget named "&eCoin" from player:
-----add arg-2 to {coin.%player%}

You see i try to use the arg-2 as an amount like '3 gold nugget named "&eCoin" in inventory:'
("-" means tab)

How can i fix that?? (Sorry for my bad English)
 
Last edited:
First of all, use codeblocks (click the + in the comment bar and select "</> Code").

And the problem there is that the item type pattern only allows literals. If you want use a variable or a expression as amount you'd have to use the following expression:
code_language.skript:
%number% of %item type%

#Example:
set {_test} to arg-2 of gold nugget
 
  • Like
Reactions: BaranHan
First of all, use codeblocks (click the + in the comment bar and select "</> Code").

And the problem there is that the item type pattern only allows literals. If you want use a variable or a expression as amount you'd have to use the following expression:
code_language.skript:
%number% of %item type%

#Example:
set {_test} to arg-2 of gold nugget

Yeah, it worked!! Thank you soooo much for helping me
[doublepost=1508875391,1508697517][/doublepost]
First of all, use codeblocks (click the + in the comment bar and select "</> Code").

And the problem there is that the item type pattern only allows literals. If you want use a variable or a expression as amount you'd have to use the following expression:
code_language.skript:
%number% of %item type%

#Example:
set {_test} to arg-2 of gold nugget

There is a bug i can use negative characters when i use i can get unlimited coins, is there a way to prevent that? please
 
Yeah, it worked!! Thank you soooo much for helping me
[doublepost=1508875391,1508697517][/doublepost]

There is a bug i can use negative characters when i use i can get unlimited coins, is there a way to prevent that? please
you can use "%arg 2%" does not contain "-"
 
Or...
code_language.skript:
command /coinstuff [<text>]:
    trigger:
        if "%arg 1%" contains "-":
            message "&cIncorrect Value."
            stop
 
Status
Not open for further replies.