Jump to content
  • 0

How to edit value by address via lua script


Shuaiouke
 Share

Question

I have seen 

How do you edit a specific memory addresses value via a lua script (#670falkv)

 before, but that's editing one specific address, I want it to edit from something like EC16100 or whatever to something like EC161FF

basically editing a bunch of addresses

PS.to the same value

Link to comment
Share on other sites

11 answers to this question

Recommended Posts

  • 0
7 hours ago, Enyby said:

1. Start fuzzy search limited specified range. Edit all found result to desired value.

2. Or. Build table with need values in loop and use setValues.

emm, is there other ways to do it? if not, how to use loop to edit value by address

Link to comment
Share on other sites

  • 0
5 hours ago, Shuaiouke said:

emm, is there other ways to do it? if not, how to use loop to edit value by address

local t = {}
t[1] = {}
t[1].address = 0x18004030
t[1].flags = gg.TYPE_DWORD
t[2] = {}
t[2].address = 0x18004034
t[2].flags = gg.TYPE_DWORD
t[3] = {}
t[3].address = 0x18004038
t[3].flags = gg.TYPE_DWORD

gg.loadResults(t)
yourTable = gg.getResults(3)

 for i,v in ipairs(yourTable) do
     yourTable.value = 10000
     yourTable.flags = gg.TYPE_DWORD
 end
 gg.setValues(yourTable)

Link to comment
Share on other sites

  • 0

So just give me a sec, I want a loop to edit the addresses one by one, that's what I mean by progressively since I don't even know there's soemthing called progressive edit, want a loop like

for(int i = 0, i < Number of the addresses, i++)

{

string t =" address";

t.value = 1;

}

at least that's how u write it in Java

Link to comment
Share on other sites

  • 0
50 minutes ago, Shuaiouke said:

that's not efficient

Have you tried it at least? I highly doubt that searching for 500 consecutive addresses and editing all of them to one value can noticeably slow down your script. So are you sure that it does not suffice because of performance reasons?

1 hour ago, Shuaiouke said:

anyone knows how to use a loop to edit addresses progressively

As pointed out above, editing values one-by-one in a loop is very inefficient. This approach should be used instead, if simple one with fuzzy search does not suffice:

On 2/3/2019 at 4:33 AM, Enyby said:

2. Or. Build table with need values in loop and use setValues.

Example of implementing it:

local startAddress = 0x12340000
local count = 500
local editValue = '555444'
local values = {}
for i = 1, count do
  values[i] = {address = startAddress; flags = gg.TYPE_DWORD; value = editValue}
  startAddress = startAddress + 4
end
gg.setValues(values)
  

 

Link to comment
Share on other sites

  • 0

first, I don't care about time since it's editing like characters u have so it's in the menu and it's singleplayer, and second, how do I make the script u made to fit what I need

first wat does editValue does and wat does values list do

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.