if held item is lightning rod:
set {_rotate::*} to "yp1" and "yp2", "yp3", "yp4", "yp5", "yp6", "yp7", "yp8", "yp9", "yp10"
set to random element out of {_rotate::*}
if random element out of {_rotate::*} is "yp1":
set {_rotate::*} to {_yp1}
set yaw of {_yp1} to 99
set pitch of {_yp1} to 9.9```
#Trying to make a rotating system.
1 messages · Page 1 of 1 (latest)
line 5 you should be employing a random variable to store your choice
or, just use like 6 instead (if you only need the random in one line)
lines 6+ also look like they need another indent
line 7 you cant use {_yp1} like that as it is a local var
damn
im so ass at skript
could you help me possibly?
i have this but it has no random element list
if held item is lightning rod:
if target entity is set:
set yaw of target entity to -179.9
set pitch of target entity to -38.8```
your indentation is still wrong, i also dont think you can set the pitch and yaw. You'll need to teleport to (the same) location with specified pitch and yaw
something like this for the very first one?
if held item is lightning rod:
set {_rotate::*} to "yp1" and "yp2", "yp3", "yp4", "yp5", "yp6", "yp7", "yp8", "yp9", "yp10"
set to random element out of {_rotation}
if random element out of {_rotation} is "yp1":
set {_rotation} to {_yp1}
set yaw of {_yp1} to 99
set pitch of {_yp1} to 9.9```
and the previous one i just sent now does infact work perfectly and the indention is correct
Im confused.
- "the previous one i just sent now does infact work perfectly and the indention is correct"
- If this #1315922947566993498 message is the previous one, no the indentation is NOT correct.
- The very last code block is identical to the first, not sure what changes you think have been made. Can you explain?
very confusing the very first one is horribly wrong, the second script send is right, the 3rd script is variable changes because you said i must change the variable from {_rotate::*} to another name so i can select the thing and i must just change line 7 to a non local variable
if it is wrong how could i indent it better?
that's not the changes you needed.
I meant line 7 you need to specify a local variable that you do want to set, right now you have set to random element..., but just like when setting any other variable it should be set {} to random element...
and you still need to add indents
You can set yaw and pitch since Skript 2.9.0. Unless your server software is Paper, you can't set players' rotation.
technically possible, but requires teleporting
this one works but the other script with random element doesn't work but im going to figure it out
it works, but the two if statements do not need to both be passed, only the second one
okay, well i changed some of it to what you said
permission: staff.tools
aliases: /stools
trigger:
give player 1 lightning rod named "&6Rotate Player" with lore "&7Right-Click to rotate player" #rotate
give player 1 stick named "&6Knockback Stick" with lore "&7Right-Click to check player knockback"
give player 1 paper named "&cPlayer Reports" with lore "&7Right-Click to see player reports" #reports
give player 1 book named "&cHistory" with lore "&7Right-Click to see player history" #history
give player 1 packed ice named "&bFreeze Player" with lore "&7Right-Click to freeze player"
on right click:
if name of tool is "&6Lightning Rod":
if target entity is set:
set {_rotate::*} to "yp1" and "yp2", "yp3", "yp4", "yp5", "yp6", "yp7", "yp8", "yp9", "yp10"
set {_rotation} to random element out of {_rotate::*}
if random element out of {_rotation} is "yp1":
set {_rotation} to {yp1}
set yaw of {yp1} to -151
set pitch of {yp1} to -9.1
send "&7[&cVULCAN&7] &7You have rotated &c%target entity%&7!"```
thats the full code i had
but i only sent the right click
and if it doesn't work would i just do set {_rotation} to player's location for the teleport method
its still very wrong
damn
On load:
Rotate
hm?
Your code is very unclear. Why not just do chance of 10%?
oh
Just do on load: rotate
i could do that
thats made up syntax
you still need to indent the code inside the name if statement
That's correct too.
seems like the easiest and simplest solution, thanks. it would work better than random element since i could put 100 and have it chance of 1%
uh i dont really understand what you mean since i dont understand the skript lingo or what everything means
You just need to try harder
If the code isn't indented more than the condition (if statement) before it, they are completely different things (you may say irrelevant) during execution of code.
I know why your code doesn't work
x8ight gave you links to two tutorials.
I don't about the quality of the first one, but I sort of know x8ight and I'm sure he wouldn't write down something plain wrong in his tutorials.
yeah, i know i just don't have anyone who says anything like that but im going to watch/read syntax indentation and things about indention and how i can fix it
x8ight is a good coder, ive seen him many times helping players out
but thanks for all the help
and uh sage why?
Because it's not correct, the code has to be correct for it to work as intended
I didn't help much, kudos to x8ight. Either way, you're welcome.
i understand it isn't correct but could you infer what isn't correct and how i could correct it?
Your code
Oh, thanks Mr. Obvious. We appreciate your help.
fr
How come I didn't realize that?
and you can correct it by removing the wrong lines and adding the correct ones
wow! i didn't know!
Now you do, your welcome 🙏
you're*
lmao
x8ight, you should write it down in your tutorial.
This way it will get more popular than Sovde's in no time.
damn, x8ight ur indention process be kinda cool
You guys should see my indentation process
nah sovde's is better, mine was originally meant to be "dont ask to be spoon-fed", but then I added other stuff I found myself saying often
i literally just use tabs instead of spaces since i thought it would work better
they're the same, really personal preference
yeah, they both work. Only thing is you cant switch between them
It was a sarcasm. Nevertheless, glad to see some Skript "educators".
should work, highly impractical
yeah you get like, space ---> tab ----> error
You're very welcome
You can even make your indentations 1 space long, imagination is the only limitation.
x8ight, im pretty sure you fixed my save inventory with a function deserialize(player) and function serialize(player)
You can also use the "ignore indentation then feed it into ai to make it fix your indentation afterwards" method
No. AI is not good at Skript, and using AI to make code is
- not helping YOU learn
- against the rules here ( #welcome-to-skunity rule 8)
no it isn't but it's good at indentation. And that's for ai generated content, not a brief mention of the 2 letters "a" and "i"
Its good at indentation because there are other whitespace languages like py
however even if AI can do indentation, indentation is literally one of the most fundamental skills everyone needs to learn and practice for themselves
yeah, thats very true
only way you can learn is by doing it yourself, learning from your mistakes, or learning from others.
you can also try the randomly hit tab and pray that your code works afterwards strategy
AI generally should be used for doing repeating and boring tasks.
That's why programmers usually use it for writing tests, sometimes documentations, etc.
or the close your computer and wait and hope until cosmic particles flips the correct bits to fix your indentation strategy
But like x8ight said, posting AI-generated content in this server (#ai-talk is an exception) is prohibited.
hey I brought it up once and I'm trying to change the topic to cosmic particles but you guys keep switching it back
it doesn't but im going to use chance of 10%
just a question, how could i add a cooldown to this?
if name of tool is "&6Rotate Player":
if target entity is set:
chance of 10%:
set {yp1} to location at target entity
set yaw of {yp1} to 67.6
set pitch of {yp1} to -59.6
teleport target entity to {yp1}
send "&8[&4&lGUPA&8] &7You have rotated &c%Target Entity%&7!" to player```
you can set a variable to now when its used, and check the time since {} < 1 hour
also you still need to indent lines 3+, this will rotate on every right-click.
{yp1} should also be a local variable
oh
i see what you mean
must i do if target entity is set: if name of tool is "&6Rotate Player":
something like that?
ill check it out and see if not ill come back
works
thanks for point that out
Nooo don't do this
Variables for cooldowns is not a good idea
@analog karma
it is if you want the cooldown to save after server restart
i don't need the cooldown anymore
or instad of a variable, you can also use metadata
Yes because he wants the staff tool that rotates a player to have a 5 day cooldown clearly
😂 Didn't need to ping me for that, though
I have automatic pinging when replying enabled
i wish it was disabled by default
I'm too lazy to disable it to it's staying lol
first time correct indentation
if target entity is not set:
if name of tool is "&6Knockback Stick":
send "&8[&4&lGUPA&8] &7Look towards an entity/player!" to player
if name of tool is "&6Knockback Stick":
if target entity is set:
chance of 50%:
push target entity backwards at speed 1.1
send "&8[&4&lGUPA&8] &7You have pushed &c%Target Entity%&7!" to player
chance of 50%:
push target entity forwards at speed 1.1
send "&8[&4&lGUPA&8] &7You have pushed &c%Target Entity%&7!" to player```
not exactly, as now this code is impossible
lines 2 and 6 contradict eachother
you want to check the name of the tool, and then indent everything else inside it,
but you want separate sections for if the target entity is set or not
ohhh
if set:
do this stuff
else if not set:
do this stuff```
if target entity is not set:
send "" to player
else:
#code here```
if target entity is not set:
if name of tool is "&6Knockback Stick":
send "&8[&4&lGUPA&8] &7Look towards an entity/player!" to player
if name of tool is "&6Knockback Stick":
if target entity is set:
chance of 50%:
push target entity backwards at speed 1.1
send "&8[&4&lGUPA&8] &7You have pushed &c%Target Entity%&7!" to player
chance of 50%:
push target entity forwards at speed 1.1
send "&8[&4&lGUPA&8] &7You have pushed &c%Target Entity%&7!" to player```
like that?
if name of tool is "&6Knockback Stick":
if target entity is not set:
send "&8[&4&lGUPA&8] &7Look towards an entity/player!" to player
else:
if name of tool is "&6Knockback Stick":
if target entity is set:
chance of 50%:
push target entity backwards at speed 1.1
send "&8[&4&lGUPA&8] &7You have pushed &c%Target Entity%&7!" to player
chance of 50%:
push target entity forwards at speed 1.1
send "&8[&4&lGUPA&8] &7You have pushed &c%Target Entity%&7!" to player```
so like that?
for perfect indentation
indentation looks good, although you have some repeat lines
- inside the
else:,
- you dont need to check for the name again (already checked for on line 2)
- you dont need to check if the target entity is set (because if its not not set, it is set, and the line 3 if will fail so the else will run)
- you seem to have duplicated the whole
chance of 50%:section
so just chance of 50%
like not just the text chance of 50% but whats underneath and stuff
uh yeah i was wondering how i would connect them
but idk how to so i just made 2x
so just else: chance of 50%: push target entity backwards at speed 1.1 send "&8[&4&lGUPA&8] &7You have pushed &c%Target Entity%&7!" to player push target entity forwards at speed 1.1 send "&8[&4&lGUPA&8] &7You have pushed &c%Target Entity%&7!" to player
something like that?
or what
i might have figured it out
else:
chance of 50%:
push target entity backwards at speed 1.1
send "&8[&4&lGUPA&8] &7You have pushed &c%Target Entity%&7!" to player
chance of 50%:
push target entity forwards at speed 1.1
send "&8[&4&lGUPA&8] &7You have pushed &c%Target Entity%&7!" to player
like that?
@naive saddle ? sry for ping
no, i just want it to happen once but pick out of the options
what do you mean