Jump to content
Enyby

LUA scripting

Recommended Posts


Am i able to program search near address as action, not on my address?

Share this post


Link to post
Share on other sites

hello everyone, let me introduce myself, my name is izeor. 🙂
I learned the script self-taught. please guide me if I'm currently developing a script.

so. like how to make a script like the following:

search value A: 50 (manual input)
and
search value B: 1000 (manunal input)
then,
value A and value B, become: 50;1000::5 ( ::5 is an absolute value )
and the value of A will be added to 375,
then it becomes A + 375 = 425

apologize if I am wrong in using the word or term.

Share this post


Link to post
Share on other sites
Quote

gg.setRanges(gg.REGION_ANONYMOUS)
key = gg.prompt({[1]='A value', [2]='B value', [3]='absolute value'}, {[1]='0', [2]='0', [3]='5'})
gg.searchNumber("[1];[2]::[3]", gg.TYPE_DWORD, false, gg.SIGN_EQUAL, 0, -1, 0)
gg.refineNumber("[1]", gg.TYPE_DWORD, false, gg.SIGN_EQUAL, 0, -1, 0)
revert = gg.getResults(100, nil, nil, nil, nil, nil, nil, nil, nil)
local t = gg.getResults(100, nil, nil, nil, nil, nil, nil, nil, nil)
for i, v in ipairs(t) do
    if v.flags == gg.TYPE_DWORD then
        v.value = v.value + "375"
    end
end
gg.setValues(t)
t = nil


local t = gg.getResults(1000, nil, nil, nil, nil, nil, nil, nil, nil)
gg.addListItems(t)
t = nil

this is what i made. Please guide me

Share this post


Link to post
Share on other sites
10 hours ago, izeor said:

this is what i made. Please guide me



gg.setRanges(gg.REGION_ANONYMOUS)
key = gg.prompt({[1]='A value', [2]='B value', [3]='absolute value'}, {[1]='0', [2]='0', [3]='5'})
gg.searchNumber(key[1].. ";" .. key[2] .. "::" .. key[3], gg.TYPE_DWORD, false, gg.SIGN_EQUAL, 0, -1, 0)
gg.refineNumber(key[1], gg.TYPE_DWORD, false, gg.SIGN_EQUAL, 0, -1, 0)
revert = gg.getResults(100)
local t = gg.getResults(100)
for i, v in ipairs(t) do
    if v.flags == gg.TYPE_DWORD then
        v.value = v.value + "375"
    end
end
gg.setValues(t)
t = nil


local t = gg.getResults(1000)
gg.addListItems(t)
t = nil

The use of single quote or double quote indicate that element inside the quotations is a string. When using a prompt, you are actually saving the user input as a table, and to call it, you need to use variable[index]. In this case, your variable is "key" and the index is 1, 2 and 3.

Share this post


Link to post
Share on other sites
Posted (edited)
7 hours ago, LuaHelper said:
  1. 
    
    
    gg.setRanges(gg.REGION_ANONYMOUS)
    key = gg.prompt({[1]='A value', [2]='B value', [3]='absolute value'}, {[1]='0', [2]='0', [3]='5'})
    gg.searchNumber(key[1].. ";" .. key[2] .. "::" .. key[3], gg.TYPE_DWORD, false, gg.SIGN_EQUAL, 0, -1, 0)
    gg.refineNumber(key[1], gg.TYPE_DWORD, false, gg.SIGN_EQUAL, 0, -1, 0)
    revert = gg.getResults(100)
    local t = gg.getResults(100)
    for i, v in ipairs(t) do
        if v.flags == gg.TYPE_DWORD then
            v.value = v.value + "375"
        end
    end
    gg.setValues(t)
    t = nil
    
    
    local t = gg.getResults(1000)
    gg.addListItems(t)
    t = nil
  2. The use of single quote or double quote indicate that element inside the quotations is a string. When using a prompt, you are actually saving the user input as a table, and to call it, you need to use variable[index]. In this case, your variable is "key" and the index is 1, 2 and 3.

Thanks
You really give enlightenment. I will try it.

Edited by izeor
I did not read carefully what the replies from the previous comments. in this post I asked for instructions "what should I do" even though it was already given to the "quote" in the comment.

Share this post


Link to post
Share on other sites

Thank you very much. it works! I am very happy.

7 hours ago, LuaHelper said:



gg.setRanges(gg.REGION_ANONYMOUS)
key = gg.prompt({[1]='A value', [2]='B value', [3]='absolute value'}, {[1]='0', [2]='0', [3]='5'})
gg.searchNumber(key[1].. ";" .. key[2] .. "::" .. key[3], gg.TYPE_DWORD, false, gg.SIGN_EQUAL, 0, -1, 0)
gg.refineNumber(key[1], gg.TYPE_DWORD, false, gg.SIGN_EQUAL, 0, -1, 0)
revert = gg.getResults(100)
local t = gg.getResults(100)
for i, v in ipairs(t) do
    if v.flags == gg.TYPE_DWORD then
        v.value = v.value + "375"
    end
end
gg.setValues(t)
t = nil


local t = gg.getResults(1000)
gg.addListItems(t)
t = nil

The use of single quote or double quote indicate that element inside the quotations is a string. When using a prompt, you are actually saving the user input as a table, and to call it, you need to use variable[index]. In this case, your variable is "key" and the index is 1, 2 and 3.

Thank you very much. it works! I am very happy !!! 😆☺️

Share this post


Link to post
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

×
×
  • Create New...