#my gen skript isnt working

1 messages · Page 1 of 1 (latest)

azure ibex
#

you didnt do anything correctly

#

syntax maybe but

main fox
#

basically theres a couple issues

oblique timber
#

local vars are only per event

main fox
#

_gens is a local variable

#

which means inside /activategens it doesnt exist

#

since it starts with an _ that makes it local

oblique timber
#

and ur using same local var in multiple events

main fox
#

basically

#

any variable whose name starts with _ is local

#

that means it doesnt exist anywhere else

#

and never gets saved

#

dont start it with _ for what you're doing

oblique timber
#
    set {_local} to 1 #local var cuz starts with _
    #end of code
    #invisible delete {_local}
    if {_local} is 1 #isnt set to anything, cuz its other event
        #do smth```
main fox
#

secondly, this line is nonsense

        set block's location to event-block
#

not really how it works

#

it never 'deletes' it like it never 'saves' it

#

it just cant be seen anywhere else

#

and is never saved

#

also you're only ever dropping anything once, in the on place event

oblique timber
#

^

#

use while loop

main fox
#

you could do a while {_gens} is true and do a wait, but then if your script or server ever restarts that becomes an issue

oblique timber
#

make sure to put wait

main fox
#

so you want to add the generator to a list of generators

oblique timber
#

their loc atleast

main fox
#

and use a every x seconds loop to get all of the generator locations and spawn the wheat

oblique timber
main fox
#

what

#

who the hell does that

#
every 10 seconds:
    #this is so much easier
oblique timber
#

who the hell uses every timespan

main fox
#

me???

oblique timber
#

damn

#

crazy

main fox
#

who the hell uses on load: while true == true:

oblique timber
#

everyone?

#

expect u

main fox
#

no

#

its jsut you

#

you're the weird one here

#

the less you do in skript the better

#

the java backend is faster than it parsing the line

#

no and i just explained why

#

if your skript ever restarts itll stop the while loop

#

and you'll need to replace all the generators

#

which is kinda stupid

#

the alternative is to save every gen to a list variable

#

have you used lists before?

#

a list variable is just a list of objects

#

so you can save multiple things

oblique timber
#

list vars are those that contain ::

main fox
#

well when you place the generator you can store the location

#

so for example, you can do add event-location to {gens::*}

#

the ::* means, in simple terms a list

oblique timber
#

aka {var::%player's uuid%} or {var::*} #every value of that var

main fox
#

and what it will do is go

{generatorloc::1} locationblah
{generatorloc::2} location2
{generatorloc::3} blahblah
oblique timber
#

yeh those are lists

main fox
#

yeah

oblique timber
#

if u loop {items::*} u get all the values from dirt, grass, etc

main fox
#

and you can search through variables that have a :: in them

#

::* means every single variable

#

kinda how permissions work

oblique timber
#

aka just "everything"

main fox
#

yknow how essentials.* means essentials.kits and essentials.home and essentials.tpaccept etc

#

lists work exactly like that

#

it means generatorloc::1 and 2 and 3

#

im not gonna give you the code

#

its better to learn

oblique timber
#

vars are basic stuff to learn

main fox
#

you need to know how lists work to make a gen system

#

gen systems use lists

#

lol

oblique timber
#

without vars, u can stop skripting right away

#

u literally use it at 90% of codes

main fox
#

anyway

#

you need to save all the locations

#

so do add event-location to {generatorPositions::*}

#

when you place it down

oblique timber
#

in on place event

main fox
#

and when you break it you need to remove it as well

oblique timber
#

and if u want fully wipe everything, just delete {var::*}

main fox
#

you put it where you place the generator

oblique timber
#

in here

main fox
#

god now i'm getting a headache lol

#

im not counting for you

oblique timber
#

lol

main fox
#

put it instead of if {gens} is true

oblique timber
#

the one where u check the placement

#

oh no

main fox
#

show us your current code then?

oblique timber
#

the 2nd last line is useless

#

i said 2nd last

#

from buttom

#

also indent

#

the last line

#

also indent the 3rd and 4th liens

#

the gap between left wall and the 1st character (number/symbol/letter)

#

aka if x is x: <indent>set x to 5

#

the tabs/spaces at the start of the line

#

fix 3rd and 4th lines

#

they have wrong indent

#

or the 2nd line itself

gray ridge
#

You should use {gens::placed::%player’s uuid%}

#

Instead of {gens}

silk glacier
#

If you use {gens} the variable counts for everyone but what gaming said is specificly for the player

azure ibex
#

No it doesn't it says there is no player in a periodical event