Jump to content
  • 0

help gg.getListItems & gg.setValues


CheatTester

Question

i have saved list like this
list:
1. name : dataone, value : 99
2. name : datatwo, value : 88
3. name : datatri, value : 77

i want to change the value with label name "dataone"
and usually iam using this to change the value 
r = gg.getListItems()

r[1].value = 9999

gg.setValues(r)

and then "dataone" value change.

===============================

but often "dataone" is randomly change place like this after i restart the game,

list:
1. name : datatwo, value : 88
2. name : datatri, value : 77
3. name : dataone, value : 99 <<<<< dataone saved to the third list

my question, can i do something like:

:: search saved list with label name "dataone" then change the value.

thank you

Link to comment
Share on other sites

6 answers to this question

Recommended Posts

Sorry another question, how about change multiple value at once like

r = gg.getListItems()

r[1].value = 9999

r[2].value = 8888

r[3].value = 7777

gg.setValues(r)

But using the name like

Dataone = 9999

Datatwo = 8888

Datatri = 7777

setValue

======

Can i get some examples? Thank you

Link to comment
Share on other sites

this work but, iam note sure, can we make it more simple?

 

t = gg.getListItems()
for i, v in ipairs(t) do
     if v.name == 'Dataone' then
        v.value = 999
    elseif v.name == 'Datatri' then
        v.value = 998
        end
        end
     gg.setValues(t)
    

Link to comment
Share on other sites

  • Administrators

You can use table which map your names to desired values. If name of item exists in table then you can edit value. Like this:
 

local val = values[v.name]
if val != nil then
    v.value = val
end

 

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.