Jump to content
  • 0

How to edit value by address via lua script


Question

11 answers to this question

Recommended Posts

  • 0
  • Administrators
Posted

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.

  • 0
Posted
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

  • 0
  • Administrators
Posted

Other ways similar. But first is most easy.

Read API help and make 3 calls for it. clearResults, startFuzzy, editAll.

  • 0
Posted

Emm you misunderstanded me I know the address I’m editing it just there’s 500 vars to change I’m not doing a fuzzy search not even a search just edit addresses

  • 0
Posted
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)

  • 0
Posted

So first, that's not efficient, since there are over 500 addresses to edit, and second, anyone knows how to use a loop to edit addresses progressively.

  • 0
  • Administrators
Posted

You choose not only worst possible way, you try it make more worst. Progressive edit is much worst in performance terms.

  • 0
Posted

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

  • 0
Posted
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)
  

 

  • 0
Posted

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

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.