#my gen skript isnt working
1 messages · Page 1 of 1 (latest)
syntax maybe but
basically theres a couple issues
local vars are only per event
_gens is a local variable
which means inside /activategens it doesnt exist
since it starts with an _ that makes it local
and ur using same local var in multiple events
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
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```
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
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
make sure to put wait
so you want to add the generator to a list of generators
their loc atleast
and use a every x seconds loop to get all of the generator locations and spawn the wheat
or just on load: while 1 is 1:
who the hell uses every timespan
me???
who the hell uses on load: while true == true:
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
list vars are those that contain ::
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
aka {var::%player's uuid%} or {var::*} #every value of that var
and what it will do is go
{generatorloc::1} locationblah
{generatorloc::2} location2
{generatorloc::3} blahblah
yeh those are lists
yeah
if u loop {items::*} u get all the values from dirt, grass, etc
and you can search through variables that have a :: in them
::* means every single variable
kinda how permissions work
aka just "everything"
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
vars are basic stuff to learn
anyway
you need to save all the locations
so do add event-location to {generatorPositions::*}
when you place it down
in on place event
and when you break it you need to remove it as well
and if u want fully wipe everything, just delete {var::*}
you put it where you place the generator
in here
lol
put it instead of if {gens} is true
show us your current code then?
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
If you use {gens} the variable counts for everyone but what gaming said is specificly for the player
No it doesn't it says there is no player in a periodical event