Jump to content

I'm trying to make a random event for every 2-7 hours using a interger but it won't work


Patsteaks123

Recommended Posts

CODE:

 

options:
 prefix: "[Server Name]"    
every {_event} hours:
 set {_event} to random integer between 2 and 7:
  if {_event} = 2:
   broadcast "message"
  if {_event} = 3:
   broadcast "message"
  if {_event} = 4:
   broadcast "message"
  if {_event} = 5:
   broadcast "message"

ERROR MSG:
can't understand this event: 'every {_event} seconds' (event.sk, line 3: every {_event} seconds:')

Edited by Patsteaks123
Link to comment
Share on other sites

21 hours ago, Patsteaks123 said:

CODE:

 

options:
 prefix: "[Server Name]"    
every {_event} hours:
 set {_event} to random integer between 2 and 7:
  if {_event} = 2:
   broadcast "message"
  if {_event} = 3:
   broadcast "message"
  if {_event} = 4:
   broadcast "message"
  if {_event} = 5:
   broadcast "message"

ERROR MSG:
can't understand this event: 'every {_event} seconds' (event.sk, line 3: every {_event} seconds:')

{_event} isnt set yet, as it is a temp variable.

 

 

image.png.bc433d6489d70ad831075fe76809b993.png
 

Owner of Lifestealed, Labs, Encore, UNOfficially and Observed
 

OG [VIP] 12/26/20 - 10/27/2021
OG [PRO] 12/27/21 - 11/18/2022
OG [LEGEND] 11/18/2022 - 3/14/2023
[DEFAULT] 3/14/2023 - 5/8/2024

[MOD] 5/8/2024 - Present

 

Link to comment
Share on other sites

1 hour ago, AgentGamerPro said:

{_event} isnt set yet, as it is a temp variable.

NEW CODE:
Still Getting Same Error
 

variables:
 {_events} = 0

options:
 prefix: "[Server Name]"    

 set {_events} to random interger between 2 and 7:
  if {_events} = 2:
   every {_events} seconds:
    broadcast "2"
	
Edited by Patsteaks123
Link to comment
Share on other sites

16 hours ago, Patsteaks123 said:

NEW CODE:
Still Getting Same Error
 

variables:
 {_events} = 0

options:
 prefix: "[Server Name]"    

 set {_events} to random interger between 2 and 7:
  if {_events} = 2:
   every {_events} seconds:
    broadcast "2"
	

thats... no. Try this

every (random integer between 2 and 7) seconds in world "world":

also for future reference:

{_variable} are temp variables. They must be set in the same section of code they are used in and are deleted once the code ends.

{variable::*} are list variables. They hold multiple items and can be looped for loop-values using loop {variable::*}:

{variable} is a standard variable that can hold one thing, but is never deleted unless cleared.

{@variable} is a variable set on skript reload. This variable is set to whatever is in the options of the skript. for example:

options:
	variable: true

 

ALSO NEVER USE {Variable.Variable2.Variable3} THEY ARE TRASH, USE {Variable::Variable2::Variable3}

Edited by AgentGamerPro
  • Like 1

 

 

image.png.bc433d6489d70ad831075fe76809b993.png
 

Owner of Lifestealed, Labs, Encore, UNOfficially and Observed
 

OG [VIP] 12/26/20 - 10/27/2021
OG [PRO] 12/27/21 - 11/18/2022
OG [LEGEND] 11/18/2022 - 3/14/2023
[DEFAULT] 3/14/2023 - 5/8/2024

[MOD] 5/8/2024 - Present

 

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...