#Trying to make a rotating system.

1 messages · Page 1 of 1 (latest)

analog karma
#
    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```
naive saddle
#

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

analog karma
#

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```
naive saddle
#

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

analog karma
# naive saddle line 5 you should be employing a random variable to store your choice or, just ...

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
naive saddle
#

Im confused.

  1. "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.
  1. The very last code block is identical to the first, not sure what changes you think have been made. Can you explain?
analog karma
#

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

analog karma
naive saddle
#

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

potent dirge
charred sage
#

technically possible, but requires teleporting

analog karma
naive saddle
#

it works, but the two if statements do not need to both be passed, only the second one

analog karma
#

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

naive saddle
#

its still very wrong

analog karma
#

damn

viral jetty
#

On load:
Rotate

analog karma
potent dirge
#

Your code is very unclear. Why not just do chance of 10%?

analog karma
#

oh

viral jetty
analog karma
#

i could do that

naive saddle
naive saddle
potent dirge
#

That's correct too.

analog karma
analog karma
viral jetty
#

You just need to try harder

potent dirge
#

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.

viral jetty
#

I know why your code doesn't work

potent dirge
#

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.

analog karma
analog karma
#

but thanks for all the help

analog karma
viral jetty
potent dirge
#

I didn't help much, kudos to x8ight. Either way, you're welcome.

analog karma
viral jetty
#

Your code

potent dirge
potent dirge
#

How come I didn't realize that?

viral jetty
#

and you can correct it by removing the wrong lines and adding the correct ones

viral jetty
#

Now you do, your welcome 🙏

naive saddle
#

you're*

analog karma
#

lmao

potent dirge
#

x8ight, you should write it down in your tutorial.

#

This way it will get more popular than Sovde's in no time.

analog karma
#

damn, x8ight ur indention process be kinda cool

viral jetty
#

You guys should see my indentation process

naive saddle
#

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

analog karma
#

i literally just use tabs instead of spaces since i thought it would work better

naive saddle
analog karma
#

oh

#

so i could use two space method or tabs?

naive saddle
#

yeah, they both work. Only thing is you cant switch between them

viral jetty
#

You can use 19 space method I believe

#

I've never tried but I assume it works too

potent dirge
naive saddle
analog karma
viral jetty
potent dirge
#

You can even make your indentations 1 space long, imagination is the only limitation.

analog karma
#

x8ight, im pretty sure you fixed my save inventory with a function deserialize(player) and function serialize(player)

viral jetty
#

You can also use the "ignore indentation then feed it into ai to make it fix your indentation afterwards" method

naive saddle
#

No. AI is not good at Skript, and using AI to make code is

  1. not helping YOU learn
  2. against the rules here ( #welcome-to-skunity rule 8)
viral jetty
#

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"

naive saddle
#

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

analog karma
#

yeah, thats very true

#

only way you can learn is by doing it yourself, learning from your mistakes, or learning from others.

viral jetty
#

you can also try the randomly hit tab and pray that your code works afterwards strategy

potent dirge
#

AI generally should be used for doing repeating and boring tasks.

#

That's why programmers usually use it for writing tests, sometimes documentations, etc.

viral jetty
#

or the close your computer and wait and hope until cosmic particles flips the correct bits to fix your indentation strategy

potent dirge
#

But like x8ight said, posting AI-generated content in this server (#ai-talk is an exception) is prohibited.

viral jetty
#

hey I brought it up once and I'm trying to change the topic to cosmic particles but you guys keep switching it back

analog karma
analog karma
#

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```
naive saddle
#

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

analog karma
#

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

naive saddle
#

you need to indent

#
  if ...:
    #code```
analog karma
#

ohh

#

you just fixed one of my problems if it is not set. thank u

viral jetty
#

Variables for cooldowns is not a good idea

#

@analog karma

charred sage
#

it is if you want the cooldown to save after server restart

analog karma
#

i don't need the cooldown anymore

charred sage
#

or instad of a variable, you can also use metadata

viral jetty
charred sage
#

😂 Didn't need to ping me for that, though

viral jetty
#

I have automatic pinging when replying enabled

charred sage
#

i wish it was disabled by default

viral jetty
#

I'm too lazy to disable it to it's staying lol

analog karma
#

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```
naive saddle
#

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

analog karma
#

ohhh

charred sage
#
if set:
  do this stuff
else if not set:
  do this stuff```
naive saddle
#
  if target entity is not set:
    send "" to player
  else:
    #code here```
analog karma
#
    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

naive saddle
#

indentation looks good, although you have some repeat lines

  1. 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)
  1. you seem to have duplicated the whole chance of 50%: section
analog karma
#

like not just the text chance of 50% but whats underneath and stuff

analog karma
#

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

naive saddle
#

if you want this to happen multiple times you can use a loop

#
  broadcast "a"```
analog karma
naive saddle
#

what do you mean