Jump to content

Question

Posted

Hi Guys,

My knowledge in mem hacking is very basic, but I love to trail and error and find my way somehow. But sometimes I need to ask if what I am trying to do is even possible or not.

I have an RPG game (doesn't matter what game) with a team of 5 Avatars each has two attributes I like to change, this makes a value of 10. I can single search each value and change them no problem. But here my problem starts. I have to search them all 10 each match, and a match only last a few seconds. I spare more time in searching all 10 values one by one changing them start the match and then start the whole process over and over. I tried to pair them and do a group search I learned to narrow the process down by pairing the two values of each Avatar I want to change. I tried to group search 8 values at once but the range between each value is over 65536 so I don`t find any results this way(is there a way to make this range unlimited, since I know the values are there and I just would like to do the whole search in one go?).

Ok, now we have this great Lua. I had my first slight touch with Lua in World of Warcraft and done everything I wanted there really good I had my fun (even if I don't know how it works I still managed to get the things I want in trial and error to run like I wanted so I was happy about my results).  Ok back to my RPG. Is it possible to write a gg Lua where I can add in all 2 values of each 5 Avatars so the Lua makes 5 times a group search of each Avatar in one rush? Bonus question if the first question all positive: To top this I have one more issue in order to change values I have to use a formula that I have created in an excel File. So I take the visual values (they only change when an Avatar levels up so I don't do this so often) that I want to change but them in the excel(the Formula never changes), calculate the Values I have to search, enter them in game guardian, change my values and voila! would be cool if I can do all this in a Lua script that would be great fun.

Recommended Posts

  • 0
  • Administrators
Posted

Of course. Second table can contain default values. But you need learn lua. I do not write scripts for everyone. This is just example.

  • 0
  • Administrators
Posted
4 hours ago, Illuminus said:

is there a way to save the Previous entries from search before?

 

function conv(B1)
	return 1072693248+1048576*math.floor(math.log(B1)/math.log(2))+math.floor(1048576*((B1+B1-math.pow(2,math.floor(math.log(B1)/math.log(2))+1))/math.pow(2,math.floor(math.log(B1)/math.log(2))+1))) 
end

local d = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10}

while true do
	while not gg.isVisible() do
		gg.sleep(100)
	end

	d = gg.prompt({'health 1', 'attack 1', 'health 2', 'attack 2', 'health 3', 'attack 3', 'health 4', 'attack 4', 'health 5', 'attack 5'}, d, 
		{'number', 'number', 'number', 'number', 'number', 'number', 'number', 'number', 'number', 'number'})
	
	if (d == nil) then 
		os.exit()
	end
	
	for i = 1, 10, 2 do
		gg.clearResults()
		local s = conv(d[i])..';'..conv(d[i+1])..'::1024'
		gg.searchNumber (s, gg.TYPE_DWORD, false, gg.SIGN_EQUAL, 0, -1)	
		gg.getResults(100)
		local log = i .. '; request = "' .. s .. '"; found = ' .. gg.getResultCount() .. '; edited = ' .. gg.editAll(conv(9999999999), gg.TYPE_DWORD)
		print(log)
		-- gg.toast(log, true)
	end
	
	gg.toast('Click on icon for next search')
	
	gg.setVisible(false) 
end

 

  • 0
Posted

Works great. i was working with

function Script:Start()
local gamedata = FileSystem:WriteFile("lastsearch.txt")
end

second attempt

file = gg.open("<filename>", "w")
file:write("Avar = "..var)
file:close()

then I saw this code but I didn't manage it to get it work

Config = { data={} }

function Config.load(filename)
  local h = fs.open(filename, 'r')
  local str = h.readAll()
  h.close()
  Config.data = textutils.unserialize(str)
end

function Config.save(filename)
  local h = fs.open(filename, 'w')
  local str = textutils.serialize(Config.data)
  h.write(str)
  h.close()
end

Config.load('config')
print(Config.data.testKey)

 

  • 0
  • Administrators
Posted
18 minutes ago, Illuminus said:

FileSystem:WriteFile("lastsearch.txt")

Need specify full path. And you can not write on any place in Android.

Something like

gg.CACHE_DIR .. "/your.file.txt"

can get you full path to file in writable dir.

And you need work with `io` lib. I do not know what is that `FileSystem:WriteFile` or `gg.open` or `fs.open` or `textutils`.

Google "lua io save file". For example: https://www.tutorialspoint.com/lua/lua_file_io.htm

-- Opens a file in read
file = io.open("test.lua", "r")

-- sets the default input file as test.lua
io.input(file)

-- prints the first line of the file
print(io.read())

-- closes the open file
io.close(file)

-- Opens a file in append mode
file = io.open("test.lua", "a")

-- sets the default output file as test.lua
io.output(file)

-- appends a word test to the last line of the file
io.write("-- End of the test.lua file")

-- closes the open file
io.close(file)

You can run

print(io)

For get list of available functions in `io` table.

On 17.07.2017 at 6:23 PM, Enyby said:

io = table(537f85ac): { [close] = close [flush] = flush [input] = input [lines] = lines [open] = open [output] = output [read] = read [tmpfile] = tmpfile [type] = type [write] = write }

 

  • 0
Posted

ok sorry your code not working

Script ended:
Script error: org.luaj.vm2.LuaError: @/sdcard/Download/Test.lua:8
`	while not gg.isVisible() do`
attempt to call nil
	at org.luaj.vm2.LuaValue.checkmetatag(LuaValue.java:2838)
	at org.luaj.vm2.LuaValue.callmt(LuaValue.java:2015)
	at org.luaj.vm2.LuaValue.call(LuaValue.java:1442)
	at org.luaj.vm2.LuaClosure.execute(LuaClosure.java:363)
	at org.luaj.vm2.LuaClosure.call(LuaClosure.java:133)
	at android.ext.Script.runScript(Script.java:1039)
	at android.ext.Script.access$8(Script.java:1032)
	at android.ext.Script$ScriptThread.run(Script.java:998)

 

_______________________________________________
added 1 minute later

Trying your new suggestions now

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