dolphinorca
-
Posts
15 -
Joined
-
Last visited
Content Type
Profiles
Forums
Downloads
Gallery
Posts posted by dolphinorca
-
-
On 6/14/2022 at 7:38 PM, CmP said:
The idea is to read enough bytes at once and then trim the string to first occurrence of quote character instead of reading one byte at a time until quote character is encountered. Generally, first approach should be better in terms of performance, because each read from memory takes significantly more time than several Lua operations, even if just one byte needs to be read.
I thought to add 12 to get position of first byte of the answer that is the next one after last quote character in searched string. I don't immediately see why it doesn't work as expected, but it seems that there is a mistake somewhere and it's fixed by your correction to use "+ 11" instead of "+ 12".
I'm still waiting for approval, but I've uploaded the script!
minnade hayaoshi quiz(みんなで早押しクイズ) Script Cheating EXAM V1.5 (#dx8430vl)And the execution speed is obviously faster. Here is a script that can compare speeds.
0 -
13 hours ago, CmP said:
The idea is to read enough bytes at once and then trim the string to first occurrence of quote character instead of reading one byte at a time until quote character is encountered. Generally, first approach should be better in terms of performance, because each read from memory takes significantly more time than several Lua operations, even if just one byte needs to be read.
I thought to add 12 to get position of first byte of the answer that is the next one after last quote character in searched string. I don't immediately see why it doesn't work as expected, but it seems that there is a mistake somewhere and it's fixed by your correction to use "+ 11" instead of "+ 12".
I will use the faster method that you have taught me. thank you very much!
1 -
1 minute ago, CmP said:
You should also consider refactoring the code to make it simpler and cleaner. For example, your "MENU1" function can be refactored to something like the following:
function MENU1() gg.setRanges(gg.REGION_ANONYMOUS) gg.clearResults() gg.searchNumber(':","answer":"', gg.TYPE_BYTE) local count = gg.getResultsCount() local results = gg.getResults(count) local answers = {} for i = 1, count, 12 do local address = results[i].address + 12 local maxLength = 1024 local answer = readBytesToString(address, maxLength) answer = answer:match('[^"]*') -- match part up to first quote character table.insert(answers, answer) end for number, answer in ipairs(answers) do print(string.format("Answer #%d:", number), answer) end gg.alert("Answer See [ON]") end
Let me know, if the code above works for you.
sorry. I'm confused if it's not my own code, and because of the 1024 byte limit(How to raise the limit, how to get one byte at a time, I don't know which is faster.), I use my own code. Thank you for the simplified code. I will refer to it.
So, I was told the code, but I couldn't get it normally. (You can fix it by changing "local address = results[i].address + 12" to +11. I've noticed it in advance and I don't know why I subtract 1.)
0 -
6 hours ago, CmP said:
To output a string Lua implementation in GG treats it as UTF-8 (by themselves Lua strings are just byte arrays), so reading bytes from memory to Lua string and passing the string to a function that outputs it ("print", "gg.alert", "gg.toast", etc) should be enough to achieve desired result in your case.
Here is an example of function for reading bytes from memory and constructing string from them:
function readBytesToString(address, length) local values = {} for i = 0, length - 1 do values[i] = {address = address + i, flags = gg.TYPE_BYTE} end values = gg.getValues(values) local bytes = {} for i, v in ipairs(values) do bytes[i] = v.value & 0xFF end return string.char(table.unpack(bytes)) end
Call it with address to read from as first argument and amount of bytes to read as second argument, for example:
local startAddress = 0x12340000 local bytesToRead = 20 local result = readBytesToString(startAddress, bytesToRead) print(result)
It worked as I expected and the result was as I expected! Thank you!!!
I don't know how it works, but I don't care.
Put the script that actually worked here.
So ... will it be solved automatically here?
0 -
-
thank you! I will try it at a later date!
56 minutes ago, SAGEPAPI said:thank you! I will try it at a later date!
0 -
I've finally come to understand the Lua language a bit.
So I decided to make a Lua script as a trial, but my work situation got stuck.
The GG reference does not have an API to get the utf-8 string from the address.
So I got the bytes, but I didn't have lua to convert from hexadecimal to utf-8.
(It really was, but I don't know how to use it, and probably not in Game Guardian)
Do you know how to get utf-8 from an address or convert from hexadecimal to utf-8?
(Use google translate)
0 -
Thank you so much @MonkeySAN
0 -
This will be helpful to me as well.
I came up with a way to save the number of results and the order, add the number of other results until the specified order is reached, and skip it, but it's too annoying.I want to change the addresses in this order
↓
1,2,3,4,5
1+2+3 skip 4 Change
for that purpose
Record the number of addresses in order
Record what is in 4 locations0 -
This worked easily.
And there was a misspelling. Noob level failure
gg.loadResults (gg.getListItems ())
mphck = gg.getResults (999999999999)
Why did this need to be added?26 minutes ago, MonkeySAN said:if ch==2 then gg.loadResults(gg.getListItems()) mphck = gg.getResults(999999999999) for i, v in ipairs(mphck) do if v.flags == gg.TYPE_FLOAT then v.value = "0.10000000149" v.freeze = true end end gg.addListItems(mphck) --gg.removeListItems(mphck) gg.clearResults() gg.clearList() mphck=nil gg.toast("MAPHACK DISABLED") end
0 -
Thank you! I will test it immediately
0 -
I created it using this script template, and although I succeeded in saving and modifying it, I can't undo it.
I've used other languages, but LUA is a beginner
this is among us script
::strt:: ch=gg.choice ({"noclip on", "noclip off"}) if ch==1 then gg.setRanges(gg.REGION_CODE_APP) gg.searchNumber('0.1', gg.TYPE_FLOAT) mphck=gg.getResults(999999999999) gg.editAll('-9', gg.TYPE_FLOAT) for i, v in ipairs(mphck) do if v.flags == gg.TYPE_FLOAT then v.value = "-9" v.freeze = false end end gg.addListItems(mphck) gg.clearResults () gg.toast("MAPHACK ACTIVE") end if ch==2 then for i, v in ipairs(mphck) do if v.flags == gg.TYPE_FLOAT then v.value = "0.10000000149" v.freeze = ture end end gg.addListItems(mphck) --gg.removeListItems(mphck) mphck=nil gg.toast("MAPHACK DISABLED") end gg.setVisible (false) while true do if gg.isVisible() then goto strt end gg.sleep(100) end
0
minnade hayaoshi quiz(みんなで早押しクイズ) Script Cheating EXAM
in LUA scripts
Posted
View File
minnade hayaoshi quiz(みんなで早押しクイズ) Script Cheating EXAM
You can see the answer and gain an advantage over the player.
2022/11/05 Checked 4.0.9 renewal