XEKEX Posted November 24, 2022 Posted November 24, 2022 Your_Table = gg.getResults(gg.getResultsCount()) ---> this function returns a table contains a key/index that contain address , value , and flags etc if you want to refresh values u need to type : Your_Table = gg.getValues(Your_Table) if you want to change it's values(if u have more than 2) then you need to make a loop and type : for key,values in pairs(Your_Table) do Your_Table[key].value = AnyValueYouWant end gg.setValues(Your_Table) to avoid writing this every time if you have many values/functions etc you can make a function that does that with less writing and You just need to declaire it one time on your script and since in lua we can insert a function inside a table and call it we can do it like so : function UP() function temp_table.update(self) local temp_table = {} -- empty temp table temp_table.results = gg.getResults(gg.getResultsCount()) -- results temp_table.update = function(self,setvalue) -- update function -------------------------------------> Updates the values for key,values in pairs(self.results) do self.results = gg.getValues(self.results) end end ------------------------------------> the self parametre allow us to call the function and make it act on its self and since it self is a table that mean it will update it self(the function call look like thistable= update(thistable) but we instead call it like this thistable:update() return temp_table end -------------------------------------------------------------------------------------------------------------- we can add if then else or any loop/conditions/ we can also add an explicit parametre to the update function like gg.setValues(Your_Table) and the final function will look like this : function UP() local temp_table = {} temp_table.results = gg.getResults(gg.getResultsCount()) temp_table.update = function(self,setvalue) for key,values in pairs(self.results) do if setvalue ~= nil then setvalue = tostring(setvalue) self.results[key].value = setvalue gg.setValues(self.results) end self.results= gg.getValues(self.results) gg.alert(tostring(self.results[key].value)..' Updated') end end return temp_table end note : you can also use assert for type(key) == 'table' so the function update rest intact -------------------------------------------------------------------------------------------------------------- Finally after You use gg.SearchValue() instead of writing : Your_Table = gg.getResults(gg.getResultsCounts()) just type Your_Table = UP() and inside the while true do add Your_Table:update() and if you want to set values just type Your_Table:update(1598) code example : LIVE code: XRecorder_Edited_24112022_140550.mp4 You can use this method to toggle ON/OFF menu and to check if specifc value met requirement for example postions like if u have X,Y values u can make a condition if X == 15 then .. etc (inside update function) I hope you get the point Enjoy
XEKEX Posted January 20, 2023 Author Posted January 20, 2023 On 1/18/2023 at 11:33 AM, lalakay said: How to Freeze value using your script You can try to save the the result to a table and use for loop to freeze the values then add update function to that table and it will keep he values freezed : for index,values in pairs(your_table) do your_table[index].freeze = FREEZE_NORMAL (or true idk x) ) end your_table:update = function(self) -- body end
_yourram Posted November 29, 2023 Posted November 29, 2023 @XEKEX can you tell what is wrong in this script, every code address is accurate but still this script edits wrong values. gg.setVisible(false) gg.clearResults() gg.setRanges(gg.REGION_C_ALLOC) gg.searchNumber('0.6;120::', 16) gg.refineNumber('0.6', 16) t = gg.getResults(1) gg.clearResults() e = {1} c = {} for i, v in ipairs(e) do table.insert(c, {address = t[1].address + 20; flags = 16; value = '99999'}) end gg.setValues(c) c = {} for i, v in ipairs(e) do table.insert(c, {address = t[1].address + B0; flags = 16; value = '99999'}) end gg.setValues(c) c = {} for i, v in ipairs(e) do table.insert(c, {address = t[1].address - 40; flags = 16; value = '1'}) end gg.setValues(c) c = {} for i, v in ipairs(e) do table.insert(c, {address = t[1].address - B0; flags = 16; value = '0'}) end gg.setValues(c)
Recommended Posts
Archived
This topic is now archived and is closed to further replies.