if Variable contains skipping

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

iJDuhb

Active Member
Mar 14, 2017
54
0
6
34
https://hastebin.com/xukedafebu.pl

So I am trying to make it if you have a code with that name and if you've already redeemed the code "I have the other code for that" And it just goes straight to the else and I think skips it. so is there a way to fix it?

( The Spacing was messed up when in hastebin )
 
Just do

code_language.skript:
if {%player%.codes::%arg-2%} is true:
    send "You have already reedem this code
else:
    send "Redeem!"


#Edit:

Like {code::*}

code_language.skript:
if {Code::%arg-2%} is set:
    #contiue code
else:
    send "Maybe you enter a wrong code?"
 
Last edited by a moderator:
Just do

code_language.skript:
if {%player%.codes::%arg-2%} is true:
    send "You have already reedem this code
else:
    send "Redeem!"
Since you don't know how his list looks, this might not work. I wager it wont. @OP this happens either because its not in that list or (the more likely option) using contains on list variables is buggy. Use this function
code_language.skript:
function contains(l: objects, c: object) :: boolean:
    loop {_l::*}:
        if loop-value is {_c}:
            return true
    return false
which can then be called like
code_language.skript:
if contains({_l::*}, "123") is %boolean%:
 
Since you don't know how his list looks, this might not work. I wager it wont. @OP this happens either because its not in that list or (the more likely option) using contains on list variables is buggy. Use this function

is just still same what i have doing it.

You're just only use Loop, what if you got 1.000 Code in variables. this would be maybe Crash the server or lags. btw mine code is maybe better? Without loop.?!

i have no problem with mine code.
 
is just still same what i have doing it.

You're just only use Loop, what if you got 1.000 Code in variables. this would be maybe Crash the server or lags. btw mine code is maybe better? Without loop.?!

i have no problem with mine code.
Its buggy, its a known issue. Its supposed to be the same thing but it isn't... it wouldn't crash
 
The only problem that I have is when I have code list it shows true, cause it sets the code when you create it to true.
how did you add code to variables?


add arg-1 to {code::*}?

if yes. i would recommecnt you change it to

set {Code::%arg-1%} to false
 
remove "add arg-2 to {Code::*}"

this is reason. if you wan't look aviable code you nee loop. example

code_language.skript:
send "Aviable Code:"
loop {Code::*}:
    send "%loop-index%" #Index is mean inside * and Value is output True or False.

#edit

If you don't want "list" then just do like this:


code_language.skript:
loop {Code::*}:
    if {_t} is set:
        set {_t} to "%{_t}%, %loop-index%"
    else:
        set {_t} to "%loop-index%"
send "Aviable Code: %{_t}%"
 
Status
Not open for further replies.