storage create

theduck

Member
Joined
Dec 6, 2018
Messages
89
Reaction score
13
I'm trying to create something using global storage

global storage = between 1 to 100
print ('1')

global storage = between 100 and 200

print ('2')
global storage = between 200 and 300
print ('2')

My question is how do you use this between '1 to 100'
 

siusiaczek

Banned User
Joined
Jun 22, 2019
Messages
107
Reaction score
36
math.random[a,b]

or
global variable = global.storage
if global.storage <= 100 then
print("1")
elseif global.storage <= 200 and global.storage >=101 then
print("2")
elseif global.storage <= 300 and global.storage >= 201 then
print("3")
end
 
OP
T

theduck

Member
Joined
Dec 6, 2018
Messages
89
Reaction score
13
Code:
local normal = 1022
local um = 200
local dois = 300
local tres = 400
local quarto = 500
local cinco = 600
local seis = 7100
local sete = 11

function onThink(interval) 
 if  getGlobalStorageValue(Storage.aleatorio) <= normal  then 

print(' (boss aleatorio)')
    elseif getGlobalStorageValue(Storage.um) <= um and getGlobalStorageValue(Storage.aleatorio) >= normal +1 then  
 
print(' (um)')


    elseif  getGlobalStorageValue(Storage.dois) <= dois and getGlobalStorageValue(Storage.um) >= um +1 then  
 
print(' (dois)') 

    elseif getGlobalStorageValue(Storage.tres) <= tres and  getGlobalStorageValue(Storage.dois) >= dois +1 then   
print(' (tres)')
 
 elseif getGlobalStorageValue(Storage.quarto) <= quarto and  getGlobalStorageValue(Storage.tres) >= tres +1 then   
print(' (quarto)')

 elseif getGlobalStorageValue(Storage.cinco) <= cinco and  getGlobalStorageValue(Storage.quarto) >= quarto +1 then   
print(' (cinco)')

 elseif getGlobalStorageValue(Storage.seis) <= seis and  getGlobalStorageValue(Storage.cinco) >= cinco +1 then   
print(' (seis)')


 elseif getGlobalStorageValue(Storage.sete) <= sete and  getGlobalStorageValue(Storage.seis) >= seis +1 then   
print(' (sete)')
end
		    
		   
  
	return true
end
in case the 'seven' has 11 in the storage most even so the normal is running the correct would run the seven direct
 
OP
T

theduck

Member
Joined
Dec 6, 2018
Messages
89
Reaction score
13
Can you msg why you need that? Im not sure if you should use that like you trying to
Do you think it can be done in another way?
my idea is the one I had the most storage will print in case it will be executed
 

Xikini

I whore myself out for likes
Premium User
Joined
Nov 17, 2010
Messages
4,097
Reaction score
2,173
We don't know what your intent is for the script, so we can't tell you a better way to do it.
 
OP
T

theduck

Member
Joined
Dec 6, 2018
Messages
89
Reaction score
13
We don't know what your intent is for the script, so we can't tell you a better way to do it.
So you have 3 storage
'"storage1 = 100
storage2 = 200
storage 3 = 300 "

when globalevents if enabled it will check
be the storage has the value to be executed
more will perform only one then
the storage1 was between 0 to 199 it is executed otherwise it goes to another and it will check if it was between 200 to 299 it executes the storage2
 
OP
T

theduck

Member
Joined
Dec 6, 2018
Messages
89
Reaction score
13
Code:
local normal = 1022
local um = 200
local dois = 300
local tres = 400
local quarto = 500
local cinco = 600
local seis = 7100
local sete = 11

function onThink(interval)
if  getGlobalStorageValue(Storage.aleatorio) <= normal  then

print(' (boss aleatorio)')
    elseif getGlobalStorageValue(Storage.um) <= um and getGlobalStorageValue(Storage.aleatorio) >= normal +1 then

print(' (um)')


    elseif  getGlobalStorageValue(Storage.dois) <= dois and getGlobalStorageValue(Storage.um) >= um +1 then

print(' (dois)')

    elseif getGlobalStorageValue(Storage.tres) <= tres and  getGlobalStorageValue(Storage.dois) >= dois +1 then
print(' (tres)')

elseif getGlobalStorageValue(Storage.quarto) <= quarto and  getGlobalStorageValue(Storage.tres) >= tres +1 then
print(' (quarto)')

elseif getGlobalStorageValue(Storage.cinco) <= cinco and  getGlobalStorageValue(Storage.quarto) >= quarto +1 then
print(' (cinco)')

elseif getGlobalStorageValue(Storage.seis) <= seis and  getGlobalStorageValue(Storage.cinco) >= cinco +1 then
print(' (seis)')


elseif getGlobalStorageValue(Storage.sete) <= sete and  getGlobalStorageValue(Storage.seis) >= seis +1 then
print(' (sete)')
end
         
        

    return true
end
in case the 'seven' has 11 in the storage most even so the normal is running the correct would run the seven direct
I'm still breaking my head on this, someone has some idea

trying to make a voting system the one who had the most votes will be created

exemple
 
Last edited:
Top