Jump to content
  • 0

Just like we change the address "value" can we also change the address "name" while using the script?


_yourram
 Share

Question

Just like we change the address "value" can we also change the address "name" while using the script?

gg.clearResults()
gg.searchNumber("8243116118139470284", 32)
gg.refineNumber("8243116118139470284", 32)
local t = gg.getResults(10)

for i,v in pairs(t) do
  
t[i].address = t[i].address - 0x30
t[i].flags = 1
t[i].value = 0
t[i].freeze = false

gg.setValues(t)
end
local t = gg.getResults(10)

for i,v in pairs(t) do
  
t[i].address = t[i].address + 0x10
t[i].flags = 16
t[i].value = 48
t[i].freeze = true

gg.setValues(t)
end
gg.clearResults()

20231231_101235.png

Link to comment
Share on other sites

Recommended Posts

  • 0
Posted (edited)
On 1/4/2024 at 6:33 AM, CmP said:

There is no API function for that. If you need it for values that were changed by your script, that can be implemented in the script itself.

[ @CmP ] oh

Edited by _yourram
no reason
Link to comment
Share on other sites

  • 0
On 1/4/2024 at 6:33 AM, CmP said:

There is no API function for that. If you need it for values that were changed by your script, that can be implemented in the script itself.

[ @CmP ] is there any alternative command for this? (I don't wanna search a code multiple times)

--- For example, what kind of script commands do I need↓

gg.setVisible(false)

function main()

choice = gg.choice({'Prepare health value','Edit it to 100','Edit it to -1','Edit it back'})

 

if choice == 1 then

gg.searchNumber('100;140', 16)

gg.refineNumber('100', 16)

controlvalue = gg.getResults(999)

gg.clearResults()

end

 

if choice == 2 then

a = {1}

b = {}

  

for i, v in ipairs(a) do

table.insert(b, {address = controlvalue[1].address; flags = 16; value = '-100'})

end

gg.setVlaues(b)

end

  

b = {}

 

if choice == 3 then

for i, v in ipairs(a) do

table.insert(b, {address = controlvalue[1].address; flags = 16; value = '-1'})

end

gg.setValues(b)

end

 

b = {}

 

if choice == 4 then

for i, v in ipairs(a) do

table.insert(b, {address = controlvalue[1].address; flags = 16; value = '100'})

end

gg.setVaalues(b)

end

end

 

while true do

if gg.isVisible() then

gg.setVisible(false)

main()

end

end

Link to comment
Share on other sites

  • 0
1 hour ago, _yourram said:

For example, what kind of script commands do I need↓

gg.setVisible(false)

gg.searchNumber('100;140', gg.TYPE_FLOAT) -- ???
-- Do you really want to search for two 4 byte numbers in 512 byte range?
gg.refineNumber('100', gg.TYPE_FLOAT)
controlvalue = gg.getResults(999) -- ???
-- If you need only first variable, why fill the table with 999 numbers?
-- May be need controlvalue = gg.getResults(1)
gg.clearResults()

choice = gg.choice({'Edit it to 100','Edit it to -1','Edit it back'})
	
	if choice == 0 then
-- insert cancel message in command gg.alert() or gg.toast()
		gg.setVisible(true)
		os.exit()
	end
		
	if choice == 1 then
		gg.setVlaues({{ address = controlvalue[1].address, flags = gg.TYPE_FLOAT, value = -100 }})
	end

	if choice == 2 then
		gg.setVlaues({{ address = controlvalue[1].address, flags = gg.TYPE_FLOAT, value = -1 }})
	end

	if choice == 3 then
		gg.setVlaues({{ address = controlvalue[1].address, flags = gg.TYPE_FLOAT, value = 100 }})
	end

gg.setVisible(true)
os.exit()

 

Edited by Count_Nosferatu
Link to comment
Share on other sites

  • 0
18 minutes ago, Count_Nosferatu said:
gg.setVisible(false)

gg.searchNumber('100;140', gg.TYPE_FLOAT) -- ???
-- Do you really want to search for two 4 byte numbers in 512 byte range?
gg.refineNumber('100', gg.TYPE_FLOAT)
controlvalue = gg.getResults(999) -- ???
-- If you need only first variable, why fill the table with 999 numbers?
-- May be need controlvalue = gg.getResults(1)
gg.clearResults()

choice = gg.choice({'Edit it to 100','Edit it to -1','Edit it back'})
	
	if choice == 0 then
-- insert cancel message in command gg.alert() or gg.toast()
		gg.setVisible(true)
		os.exit()
	end
		
	if choice == 1 then
		gg.setVlaues({{ address = controlvalue[1].address, flags = gg.TYPE_FLOAT, value = -100 }})
	end

	if choice == 2 then
		gg.setVlaues({{ address = controlvalue[1].address, flags = gg.TYPE_FLOAT, value = -1 }})
	end

	if choice == 3 then
		gg.setVlaues({{ address = controlvalue[1].address, flags = gg.TYPE_FLOAT, value = 100 }})
	end

gg.setVisible(true)
os.exit()

 

[ @Count_Nosferatu ] why did i get the error, what mistakes i'm doing?

gg.clearResults()

gg.searchNumber('100;140', 16)

gg.refineNumber('100', 16)

controlvalue = gg.getResults(1)

gg.addListItems(controlvalue)

gg.clearResults()

choice = gg.choice({'Edit it to 100','Edit it to -1','Edit it back'})

 

 if choice == 0 then

         gg.alert()

  gg.setVisible(true)

  os.exit()

 end

  

 if choice == 1 then

  gg.setVlaues({{ address = controlvalue[1].address, flags = gg.TYPE_FLOAT, value = -100 }})

 end

 

 if choice == 2 then

  gg.setVlaues({{ address = controlvalue[1].address, flags = gg.TYPE_FLOAT, value = -1 }})

 end

 

 if choice == 3 then

  gg.setVlaues({{ address = controlvalue[1].address, flags = gg.TYPE_FLOAT, value = 100 }})

 end

 

gg.setVisible(true)

os.exit()

 

Screenshot_20240105-195158_Multi Parallel.png

Link to comment
Share on other sites

  • 0

[ @_yourram ]
---

Quote

why did i get the error, what mistakes i'm doing?

You gotta be kidding me. Make sure to READ the error message and do double check to really sure the command is correct. You need to change:

gg.setVlaues -- Wrong
gg.setValues -- Correct

---

Edited by kiynox
Link to comment
Share on other sites

  • 0
18 minutes ago, kiynox said:

You gotta be kidding me. Make sure to READ the error message and do double check to really sure the command is correct. You need to change:

lmao, I didn't really notice this 😂

Link to comment
Share on other sites

  • 0
Posted (edited)

[ @kiynox ] what does the script wants?

--Search Float

 gg.searchNumber('140', 16)

--Get search results

results = gg.getResults(gg.getResultsCount())

--Store addresses that wants to be edited

edits = {}

--Edit 3,6,9 result

for k, v in ipairs({3,6,9}) do

 if v ~= nil then

  edits[#edits + 1] ={

   address = results[k].address

   value = results[k].value '17' --Change your value here

   flags = results[k].flags

  }

 end

end

--Apply edits

gg.setValues(edits)

--Save edits

gg.addListItems(edits)

20240105_231417.jpg

Edited by _yourram
no reason
Link to comment
Share on other sites

  • 0

[ @_yourram ]
---

Quote

what does the script wants?

You put your value after the variable instead of replacing the variable. That's wrong:

-- Wrong:
value = results[v].value '17'
-- Correct:
value = '17'

---
This looks like my script, here, I improve it a little bit:

gg.searchNumber('140', gg.TYPE_FLOAT)
results = gg.getResults(gg.getResultsCount())
edits = {}
for k, v in ipairs({3,6,9}) do
	edits[#edits + 1] ={
		address = results[v].address
		value = '17'
		--gg.TYPE_FLOAT = 16
		flags = gg.TYPE_FLOAT 
	}
end
gg.setValues(edits)
gg.addListItems(edits)

---
*Do note that the script above will only edit the 3, 6 & 9 position of the results.
*I told you to read the error message carefully.

Link to comment
Share on other sites

  • 0
Posted (edited)
6 hours ago, kiynox said:
gg.searchNumber('140', gg.TYPE_FLOAT)
results = gg.getResults(gg.getResultsCount())
edits = {}
for k, v in ipairs({3,6,9}) do
	edits[#edits + 1] ={
		address = results[v].address
		value = '17'
		--gg.TYPE_FLOAT = 16
		flags = gg.TYPE_FLOAT 
	}
end
gg.setValues(edits)
gg.addListItems(edits)

[ @kiynox ] still got error :!

gg.searchNumber('140', 16)

results = gg.getResults(gg.getResultsCount())

edits = {}

for k, v in ipairs({3,6,9}) do

 edits[#edits + 1] ={

  address = results[v].address

  value = '999'

  --gg.TYPE_FLOAT = 16

  flags = gg.TYPE_FLOAT

 }

end

gg.setValues(edits)

gg.addListItems(edits)

20240106_091850.jpg

6 hours ago, kiynox said:

*I told you to read the error message carefully.

I read but I didn't understand anything so I asked

Edited by _yourram
no reason
Link to comment
Share on other sites

  • 0

[ @_yourram ]
---
Sorry I forgot to add commas:

gg.searchNumber('140', gg.TYPE_FLOAT)
results = gg.getResults(gg.getResultsCount())
edits = {}
for k, v in ipairs({3,6,9}) do
	edits[#edits + 1] = {
		address = results[v].address,
		value = '17',
		--gg.TYPE_FLOAT = 16
		flags = gg.TYPE_FLOAT 
	}
end
gg.setValues(edits)
gg.addListItems(edits)

---
Should work now.

Link to comment
Share on other sites

  • 0
Posted (edited)
6 hours ago, kiynox said:
gg.searchNumber('140', gg.TYPE_FLOAT)
results = gg.getResults(gg.getResultsCount())
edits = {}
for k, v in ipairs({3,6,9}) do
	edits[#edits + 1] = {
		address = results[v].address,
		value = '17',
		--gg.TYPE_FLOAT = 16
		flags = gg.TYPE_FLOAT 
	}
end
gg.setValues(edits)
gg.addListItems(edits)

---
Should work now.

[ @kiynox ] bruh :!

20240106_171236.jpg

sorry but I couldn't upload a high resolution image

Edited by _yourram
no reason
Link to comment
Share on other sites

  • 0

[ @_yourram ]
---

Quote

bruh :!

As I said earlier, the script will edit the 3rd, 6th & 9th position of the results. If your results is less than 3, 6 & 9; better just edit them all.

gg.searchNumber('140', gg.TYPE_FLOAT)
results = gg.getResults(gg.getResultsCount())
if results ~= nil then
	edits = {}
	for k, v in ipairs(results) do
		edits[#edits + 1] = {
			address = v.address,
			value = '17',
			--gg.TYPE_FLOAT = 16
			flags = v.flags
		}
	end
	gg.setValues(edits)
	gg.addListItems(edits)
end

---

Link to comment
Share on other sites

  • 0
Posted (edited)

[ @kiynox ]

---

2 hours ago, kiynox said:

As I said earlier, the script will edit the 3rd, 6th & 9th position of the results. If your results is less than 3, 6 & 9; better just edit them all.

mhm thanks, and i didn't use "end" function that's why I was getting the error lol

2 hours ago, kiynox said:
gg.searchNumber('140', gg.TYPE_FLOAT)
results = gg.getResults(gg.getResultsCount())
if results ~= nil then
	edits = {}
	for k, v in ipairs(results) do
		edits[#edits + 1] = {
			address = v.address,
			value = '17',
			--gg.TYPE_FLOAT = 16
			flags = v.flags
		}
	end
	gg.setValues(edits)
	gg.addListItems(edits)
end

---                                                         

its working, well bro where can I know more functions about the script?   

Edited by _yourram
no reason
Link to comment
Share on other sites

  • 0

[ @_yourram ]
---

Quote

well bro where can I know more functions about the script?   

Always read our documentation here: gg documentation. But yeah, I will explain the script:

--Searching float: 140
gg.searchNumber('140', gg.TYPE_FLOAT)
--Get the results (gg.getResullts()) from how many results found (gg.getResultsCount())
results = gg.getResults(gg.getResultsCount())
--If the results is NOT empty then do these:
if results ~= nil then
	--Store modified values
	edits = {}
	--Enumerate the 'results': {{blah},{blah}}
	--In lua, {{blah},{blah}} is equal to {[1]={blah},[2]={blah}} following on how 'array' works in other programming language
	--'key' refers to: "[1]", "[2]" and so on. 'value' refers to: {blah} and so on.
	--'value' tables contain: {address, value, flags}
	--'ipairs' is function that enumerate 'key' and 'value' from a table, 'pairs' is function that enumerate ONLY 'key'.
	for key, value in ipairs(results) do
		--Store table into 'edits' table with position (edits[position]): total item in 'edits' table (#edits) + 1
		edits[#edits + 1] = {
			--Passing value of 'address' from 'value' table
			address = value.address,
			value = '17',
			--gg.TYPE_FLOAT = 16
			--Passing value of 'flags' from 'value' table
			flags = value.flags
		}
	end
	--Apply the value 'edits' table into memory
	gg.setValues(edits)
	--Save the 'edits' table into game guardian saved list.
	gg.addListItems(edits)
end

---

Edited by kiynox
Link to comment
Share on other sites

  • 0

[ @kiynox ] thanks buddy! one more question ↓

is it useless to save values with different names? because when we use gg.loadResults(gg.getListItems(energy)) or gg.loadResults(gg.getListItems(health)) it gets all the values, well there is also an option for this we can use "refineNumber" but still it is useless for values which have same value. 

Example ↓

function Main()

Menu = gg.choice({'Prepare Values','Search','Undo','Exit'})

if Menu == 1 then FIRST() end

if Menu == 2 then FIRST1() end

if Menu == 3 then FIRST2() end

if Menu == 4 then Exit()end

while true do

 if gg.isVisible() then

  gg.setVisible(false)

  Main()

 end

end

end

 

function FIRST()

-------------control --------------------

gg.searchNumber('55;873', 16)

gg.refineNumber('55', 16)

control = gg.getResults(10)

gg.addListItems(control)

gg.clearResults()

-------------health --------------------

gg.clearResults()

gg.searchNumber('47;67', 16)

gg.refineNumber('47', 16)

health = gg.getResults(10)

gg.addListItems(health)

gg.clearResults() 

-------------energy --------------------

gg.searchNumber('666;32;47', 16)

gg.refineNumber('47', 16)

energy = gg.getResults(10)

gg.addListItems(engery)

gg.clearResults()

end

 

function FIRST1()

-------------control--------------------

gg.loadResults(gg.getListItems(control))

gg.refineNumber('55',16)

gg.getResults(100)

gg.editAll('-55', 16)

gg.clearResults()

-------------health --------------------

gg.clearResults()

gg.loadResults(gg.getListItems(health))

gg.refineNumber('47',16) 

gg.getResults(100)

gg.editAll('0', 16)

gg.clearResults()

-------------energy --------------------

gg.loadResults(gg.getListItems(energy))

gg.refineNumber('47',16)

gg.getResults(100)

gg.editAll('999', 16)

gg.clearResults()

end

 

function FIRST2()

-------------control--------------------

gg.loadResults(gg.getListItems(control))

gg.refineNumber('-55',16)

gg.getResults(100)

gg.editAll('55', 16)

gg.clearResults()

-------------health --------------------

gg.clearResults()

gg.loadResults(gg.getListItems(health))

gg.refineNumber('0',16) 

gg.getResults(100)

gg.editAll('47', 16)

gg.clearResults()

-------------energy --------------------

gg.loadResults(gg.getListItems(energy))

gg.refineNumber('999',16)

gg.getResults(100)

gg.editAll('47', 16)

gg.clearResults()

end

 

function Exit()

os.exit()

end

 

 

GOD=-1

while(true)do

if gg.isVisible(true) then

GOD=1

gg.setVisible(false)

end

if GOD==1 then

Main()

end

end

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • 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.