#Skript not functioning properly
1 messages · Page 1 of 1 (latest)
why are those files so big

no it doesn't
which is weird because both scripts have almost equal functions
also, the problem is never 'skript not functioning properly' it's a user error
I can convert them to yaml if you want
did you make another function with same name?
apologies for mislabelling it, this is how I interpreted the problem
they will overwrite unless local functions
both files are named differently, one is bosschest, and one is bosschestlegendary
function, not file name
what would this look like?
function myFunc():
try debugging by broadcasting values and see where it stops working
okay, I will try this!
I do not understand what this looks like..my file just looks like this
….
You how you could just do
execute console command "/lootchest respawn LSLegendary%{_random}%"

And then delete all of the ifs and else ifs and all that
oh wait what
if I wanted to repeat the function 3 times, what would that look like?
Yeah percentages around something replaces it with the value
loop 3 times:
loop 3 times:
function()
So if it’s 21 it’ll replace it with 21 and do that chest, if it’s 63 it’ll do that one, etc no need for conditions
so it would look like this?
yes
You need a trugger
And you need to set random still
But besides that yeah
So it’d be
Yeendifhisksa
Do you, by chance, know skript at all?
The loop goes in the trigger
And you still have to set random
I have no understanding, im sorry, this was the first thing I picked up that made sense towards what I was trying to do
command /bosschest:
trigger:
loop 3 times:
execute blah blah
could I be sent something to educate me on the functions I am trying to understand?
yes
Yes now you just have to set random to a random number between 1 and 70 like you had befor
before the execute line
try it
100+ lines down to 6
if you have repetitive code it can always be simplified
the only issue is it's doing numbers with decimals
Yeah it’s random int sorry
btw if you didn't know, you can do /sk reload scripts instead of restarting your server
Or just /sk reload <skript>
ive been doing this, yes ty!!
Very useful when you have like 200 
this worked!!
Cool
if you don't wanna flood your console it might be possible to use the plugins internal api instead of running console commands, but that is a bit complicated
yw
If the plugin has javadocs it should be very easy with reflect
how could I simplify my other script?
it has an additional variable
there are 3 tiers of chests
Why not just use chance?
and I set it up with 3 different values that equate to percentages
60% common
35% rare
5% legendary
how would that look?
chance 60%:
stuff
else chance 35%:
stuff
else chance 5%:
stuff```
set random same as in the other script, and then use chance to decide the rarity
Actually it might be
else:
chance``` instead of else chance
But I know that chance statements can fire an else
else if
oh right maybe it’s else if chance?
…
No chances fire an else
I can’t check rn it’s really late
A chance is a Boolean not a condition it only has one other value
So it’s just else not else if iirc
I really don't think I did this right, but I tried
What the actual fuck
im sorry 😭
Nah nah you’re trolling
if chance of 60%:
stuff
else if chance of 35%:
stuff
replacing stuff with the execute lines
really?
it has a chance to be true or false
pretty sure it is
I think this is more on track?
I would need to repeat the trigger 70 times though, but I cant just use the repeat like last time because the number goes up this time, and cannot repeat, it needs to test which tier for all chests 1-70
remove else if condition:
and put if before the first chance
no
completely remove 'else if condition:'
the whole line
and then make it 'if chance 60%'
indent everything after the trigger
how would I go about repeating this 70 times, so that each time it makes sure the number goes up by 1 on each of the "LSCommon1"
Use an increment
loop 70 times: and then loop-index
Oh true nvm
right after the trigger put loop 70 times
Could also use loop-number
and then replace the 1's with %loop-index%
(This isn’t necessary as ‘if’ is always optional in conditions)
chance of
Oh it’s chance of
Didn’t realize that was a necessary bit of syntax idk I don’t like chance
yeah try it
Mf you need to learn skript nah I’m out
this worked!
is there a document that explains how to do the increment integer? or could you explain it?
replace the last chance with just else:
so instead of else if chance of 5%: just do else:
i think these chances don't add up like that but idk how to do the math
cause it's checking that chance each time instead of adding onto the other ones
where does this fit in
above trigger?
and then indent, correct?
yes
hows this?
that should work
I'll try it!
it loaded properly, hope it works, thank you chicken
I'm not sure why, but it skipped a few numbers
it'll do that, because it's random
how can I make it guarenteed to run all 1-70?
maybe not guaranteed, but you can do it so if the 35 and 5 percent chances don't do anything, the fallback 60 is always run: chance of 35%: do this else chance of 5%: do this instead else: # don't use chance this will always run
If you have a chance for the last one, there is a chance that nothing happens, because out of 100 times, 60 of them will do something.
that's what i was trying to say
for example if you had 2 50% chances, the top would be 50% but the bottom would be 25%
and the last 25% nothing would happen
so maybe setting a number and checking if it's between is best way here
unless there's another way to use chance
or do my method, and the last 60% chance is guaranteed to happen
but then it's not accurate percents. it's hard to know what chance for which ones
if you check between it's easy to see the chance
true.
either my or your method will work
but yeah, setting specific values (preferrably 1 to 100) would be better than using % chances
1 - 50: 50%
50 - 70: 20%
70 - 100: 30%
set {_random} to random number between 1 and 100
if {_random} is more than 60:
stuff
if {_random} is more than 35:
stuff
else: # this is the remaining percent, in this case 5%
stuff
@viscid arch
this is what I had before, going up to 70 manually, how can I do it with an integer so its not going to skip numbers?
so that its not a multi hundred line script
loop 70 times:
set {_random} to random number between 1 and 100
if {_random} is more than 60:
execute console command "/lootchest respawn LSCommon%loop-iteration%"
if {_random} is more than 35:
same but for rare
else: # this is the remaining percent, in this case 5%
same but for legendary
@viscid arch
like what you did here, but replacing the way the chance works
in the future, the first thing you should try is debugging, that'll tell you what/why it doesnt work without the need to come here
okay sorry
I will try this now
I believe I did it correctly
like this?
What they mean is you could use
...
else if {_random} <= 95:
...
else:
...```
woould I still need the else if
(less, not more)
there is a way to do it where you put the actual numbers
hang on i got confused lol
maybe not idk
Like this?
I did haha, I am not using script for anything else but am sure I will need to write similar scripts for the same function on my server in other areas, so I will use the knowledge to make those work too
thank you for all your help chicken and everyone else
have a good day/night
<3
wholesome skunity moment? impossible