Jump to content
  • 0

How to remove named value in the save list?


KarimIdris999997

Question

function FLYL()--freeze fly code
gg.clearResults()
gg.setRanges(gg.REGION_C_ALLOC)
gg.searchNumber("10000", gg.TYPE_DWORD, false, gg.SIGN_EQUAL, 0, -1)
local t = gg.getResults(900)
for i, v in ipairs(t) do
v.value = "9999"
v.name ='lock fly'
v.freeze = true
v.freezeType = gg.FREEZE_NORMAL
end
gg.addListItems(t)
gg.toast(" lock fly ")
end

function FLYU()--unfreeze fly code
local ros = gg.getListItems()
for i, v in ipairs(ros) do
if v.name == "lock fly" then
local x == gg.getListItems()
v.value = "9999"
v.name = 'lock fly'
v.freeze = false
v.freezeType = gg.FREEZE_NORMAL
end
end
gg.removeListItems(x)
gg.toast(" unlock fly ")
end

From the command above,i dont know the suitable command to remove the named value in the save list,

I know ,i can simply unuse the gg.clearResults() command after searching a value,and freeze/unfreeze by adding the searched value using gg.addListItems() command.But this is what it is,i mean if this was only the method to freeze/unfreeze value then it would be trouble some to edit multiple value at the same time,also to freeze/unfreeze value without affecting another value in the saved list.

i hope someone could write the correct command for me so i can finish my script.

@MonkeySAN @Rizuki

Link to comment
Share on other sites

6 answers to this question

Recommended Posts

sorry forgot to add

function FLYU()--unfreeze fly code
local ros = gg.getListItems()
for i, v in ipairs(ros) do
if v.name == "lock fly" then
local x == gg.getListItems()
v.value = "9999"
v.name = 'lock fly'
v.freeze = false
v.freezeType = gg.FREEZE_NORMAL
end
end
gg.setValues(ros)
gg.removeListItems(x)
gg.toast(" unlock fly ")
end

 

Link to comment
Share on other sites

6 minutes ago, CmP said:

function FLYU() --unfreeze fly code
  local ros = gg.getListItems()
  for i, v in ipairs(ros) do
    if v.name ~= "lock fly" then
      v = nil
    end
  end
  gg.removeListItems(ros)
  gg.toast(" unlock fly ")
end

 

Thank you CmP, i doesn't expected to get immediate reply for this topic,btw the command is simply remove all the save list,but how to remove only the 'lock fly' in the save list.I hope you can understand..Sorry to trouble you..Thank You

Link to comment
Share on other sites

29 minutes ago, CmP said:

The code removes only elements with name "lock fly". You can test it by manually adding 2 values to saved list, setting name of one value to "lock fly" and executing the code from my post.

Thank You CmP for you help, i've already execute the code but it end up the same. Sorry CmP for my inconvenient .

Link to comment
Share on other sites

You are right, the code from my post above doesn't work as expected. There is a mistake in it. Here is a fixed version of the code that works for me: 

local ros = gg.getListItems()
for i, v in ipairs(ros) do
  if v.name ~= "lock fly" then
    ros[i] = nil
  end
end
gg.removeListItems(ros)
gg.toast(" unlock fly ")
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.