Jump to content
  • 0

script I need to know how do I increase a value!


alex772

Question

exemple:

 

a = 5

print(a) -- 5

a = a + 1

print(a) -- 6

 

how do I make that value increase to a certain value? I want it to increase from 1 in 1 to 100 (for example) I don't want it to become 100, I want it to increase until it reaches 100!

my idea is to save several addresses using one as a base (this I already know how to do), however I want him to add the address to the next address alone or else he will be saving the same code unless I make a lot of lines for saving him 100 times would be too much to write that!

function test() 
local t1 = gg.getResults(1) 
   if t1[1] == nil then return 
  else 
  a = { 
               { 
                  address = t1[1].address + cpum,
                  flags = 4, -- Dword} 
                  freeze = true, 
                  value = 0 
               } 
            } 
    gg.addListItems(a)
    end 
end 

Link to comment
Share on other sites

1 answer to this question

Recommended Posts

1 hour ago, alex772 said:

how do I make that value increase to a certain value? I want it to increase from 1 in 1 to 100 (for example) I don't want it to become 100, I want it to increase until it reaches 100!

Use numeric for loop: 

for i = 1, 100, 1 do
  print(i)
end

More info about it can be found in Lua reference manual: https://www.lua.org/manual/5.3/manual.html#3.3.5

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.