• Hey! Register here to create your account, engage with the community, and talk about what is new!

Public variable

IceFreeze008

New member
Joined
Oct 30, 2020
Messages
9
Reaction score
0
Is there a way to make a variable public, i.e. the same for everyone?

For example, I have code that generates something and I don't want to make it player based. That means if there is at least 1 player on my plot, the generator is still working.
 

Vulcano

Forum adept
Overlord
Joined
Sep 11, 2020
Messages
243
Reaction score
63
don't put %default or %uuid in it
 

titedog

Active member
Joined
Sep 9, 2020
Messages
47
Reaction score
15
I tried, it doesn't work. If the player who triggered the generator left the plot, it stops. Although there is still a player.
What do you mean it "just stops"? If possible provide screenshots or videos.
 

titedog

Active member
Joined
Sep 9, 2020
Messages
47
Reaction score
15
that doesn't seem like a problem with the variable itself, what are you using to place those blocks? Repeat on grid?
 

IceFreeze008

New member
Joined
Oct 30, 2020
Messages
9
Reaction score
0
Would be smarter, but I just use coordinates that I then shift in the direction to place blocks
 

Vulcano

Forum adept
Overlord
Joined
Sep 11, 2020
Messages
243
Reaction score
63
That is probably because the selected object when the process is called is the player, so when they leave the process stops. If there are no players on the plot all threads will stop aswell.
 

K_Sasha

Active member
Joined
Aug 16, 2020
Messages
40
Reaction score
45
Run the code on a process with no targets. If you are unfamiliar with processes, they are similar to functions. Set the targeting mode with the tag in the start process chest.
 

IceFreeze008

New member
Joined
Oct 30, 2020
Messages
9
Reaction score
0
Run the code on a process with no targets. If you are unfamiliar with processes, they are similar to functions. Set the targeting mode with the tag in the start process chest.


As you can see on the screenshots, before I execute the function, I select nothing.

2020-11-02_13.47.31.png
 

Vulcano

Forum adept
Overlord
Joined
Sep 11, 2020
Messages
243
Reaction score
63
,,, he put a function for organization and it literally doesnt affect the code
It wastes space and is pointless. You don't even need a function for that, just set the process to have no targets...
 

K_Sasha

Active member
Joined
Aug 16, 2020
Messages
40
Reaction score
45
It's fine to use a function, he is likely planning to add more onto it.

I was referring to the tag in the Start Process block (set the "Target Mode" tag to "With no targets") when I said "run the code on a process with no targets", not Select Object. You do not need the Select Object block.
 

IceFreeze008

New member
Joined
Oct 30, 2020
Messages
9
Reaction score
0
It's fine to use a function, he is likely planning to add more onto it.

I was referring to the tag in the Start Process block (set the "Target Mode" tag to "With no targets") when I said "run the code on a process with no targets", not Select Object. You do not need the Select Object block.

That's right, I'll add more to this funktion. Thanks to everyone, because the "no targets" worked! Of course, it stops when there are no players on the plot, but that doesn't matter.
 
Top Bottom