allroundergaming Posted April 12, 2021 Posted April 12, 2021 I don't understand why my script is not working what I am doing wrong here is the script that I created gg.clearResults() gg.searchNumber('-574,128,128',4) gg.searchAddress("7AC4102570") if gg.getResultCount()==0 then print('No results.') os.exit() end r = gg.getResults(1) gg.clearResults() r = gg.getValues({ { address = r[1].address-356, flags = 4 }, { address = r[1].address-352, flags = 4 }, { address = r[1].address-348, flags = 4 }, { address = r[1].address-344, flags = 4 }, { address = r[1].address-340, flags = 4 }, { address = r[1].address-336, flags = 4 }, }) for i=1, #r do if i==6 then r.value=6 end if i==9 then r.value=9 end if i==0 then r.value=0 end r.freeze = true end gg.addListItems(r) it should edit the value like this :- 6;6;9;6;6;9 But it edits the value like this :- 6;6;9;6;6;6 someone please please help me. THANK YOU.
MarioRossi93i Posted April 12, 2021 Posted April 12, 2021 6 hours ago, allroundergaming said: I don't understand why my script is not working what I am doing wrong here is the script that I created gg.clearResults() gg.searchNumber('-574,128,128',4) gg.searchAddress("7AC4102570") if gg.getResultCount()==0 then print('No results.') os.exit() end r = gg.getResults(1) gg.clearResults() r = gg.getValues({ { address = r[1].address-356, flags = 4 }, { address = r[1].address-352, flags = 4 }, { address = r[1].address-348, flags = 4 }, { address = r[1].address-344, flags = 4 }, { address = r[1].address-340, flags = 4 }, { address = r[1].address-336, flags = 4 }, }) for i=1, #r do if i==6 then r.value=6 end if i==9 then r.value=9 end if i==0 then r.value=0 end r.freeze = true end gg.addListItems(r) it should edit the value like this :- 6;6;9;6;6;9 But it edits the value like this :- 6;6;9;6;6;6 someone please please help me. THANK YOU. gg.clearResults() gg.searchNumber('-574,128,128',4) -- why search this if you don t use it? gg.searchAddress("7AC4102570") if gg.getResultCount()==0 then print('No results.') os.exit() end r = gg.getResults(1) gg.clearResults() r = gg.getValues({ { address = r[1].address-356, flags = 4 }, { address = r[1].address-352, flags = 4 }, { address = r[1].address-348, flags = 4 }, { address = r[1].address-344, flags = 4 }, { address = r[1].address-340, flags = 4 }, { address = r[1].address-336, flags = 4 }, }) for i=1, #r do if i==6 then r.value=6 end -- you should use r[i].value if i==9 then r.value=9 end if i==0 then r.value=0 end -- 'i' can t be equal 0 r.freeze = true end gg.addListItems(r)
CmP Posted April 12, 2021 Posted April 12, 2021 You don't need to use "getValues" function, if you just need to set the values (whether with freeze or without) regardless of their current value. gg.clearResults() gg.searchNumber('-574,128,128',4) gg.searchAddress("7AC4102570") if gg.getResultCount()==0 then print('No results.') os.exit() end r = gg.getResults(1) gg.clearResults() local addr = r[1].address local v = { {address = addr - 356, value = 6}, {address = addr - 352, value = 6}, {address = addr - 348, value = 9}, {address = addr - 344, value = 6}, {address = addr - 340, value = 6}, {address = addr - 336, value = 9} } for i, v in ipairs(v) do v.flags = 4 v.freeze = true end gg.addListItems(v)
MAARS Posted April 12, 2021 Posted April 12, 2021 2 hours ago, CmP said: You don't need to use "getValues" function, if you just need to set the values (whether with freeze or without) regardless of their current value. gg.clearResults() gg.searchNumber('-574,128,128',4) gg.searchAddress("7AC4102570") if gg.getResultCount()==0 then print('No results.') os.exit() end r = gg.getResults(1) gg.clearResults() local addr = r[1].address local v = { {address = addr - 356, value = 6}, {address = addr - 352, value = 6}, {address = addr - 348, value = 9}, {address = addr - 344, value = 6}, {address = addr - 340, value = 6}, {address = addr - 336, value = 9} } for i, v in ipairs(v) do v.flags = 4 v.freeze = true end gg.addListItems(v) Clean code
Question
allroundergaming
I don't understand why my script is not working what I am doing wrong here is the script that I created
gg.clearResults()
gg.searchNumber('-574,128,128',4)
gg.searchAddress("7AC4102570")
if gg.getResultCount()==0 then
print('No results.')
os.exit()
end
r = gg.getResults(1)
gg.clearResults()
r = gg.getValues({
{
address = r[1].address-356,
flags = 4
},
{
address = r[1].address-352,
flags = 4
},
{
address = r[1].address-348,
flags = 4
},
{
address = r[1].address-344,
flags = 4
},
{
address = r[1].address-340,
flags = 4
},
{
address = r[1].address-336,
flags = 4
},
})
for i=1, #r do
if i==6 then r.value=6 end
if i==9 then r.value=9 end
if i==0 then r.value=0 end
r.freeze = true
end
gg.addListItems(r)
it should edit the value like this :- 6;6;9;6;6;9
But it edits the value like this :- 6;6;9;6;6;6
someone please please help me.
THANK YOU.
3 answers to this question
Recommended Posts
Archived
This topic is now archived and is closed to further replies.