Jump to content

LUA scripting


Enyby
 Share

Recommended Posts

  • 1 month later...

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.

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

Link to comment
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.

Link to comment
Share on other sites

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.
Link to comment
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 !!! 😆☺️

Link to comment
Share on other sites

  • 1 month later...

Hi,I'm a newbie.

In my menu choice it has Fly mode and i want it to be like this ↓

I edit to "Fly up" code (1065000000) and then in a second it will automatically edit to "Fly stay"(-2105078422)

i tried sleep function and this happent to me>

I return to menu choice and tap "Fly down" and it didn't fly down until i exit script..

gg.editAll('1065000000', gg.TYPE_DWORD)
gg.toast('UP')
gg.sleep(2000)
gg.editAll('-2105078422', gg.TYPE_DWORD)
gg.toast('STAY')

is there any command that i can use..plss help me i provided the code..

 

Edited by HAaHUuHIi
better understanding issue
Link to comment
Share on other sites

  • 4 months later...

I wanted to make a script that could search for three numbers and change them to different values.

Here is my code:

gg.searchNumber (“ 1462; 46; 84”,gg.TYPE_DOUBLE,false,gg.SIGN_ EQUAL ,0,-1,0)
gg.getResults(3)
gg.editALL(“ 50000; 5000; 1000”,gg。 TYPE_DOUBLE)

Edited by canjianfei
Link to comment
Share on other sites

  • 2 weeks later...
On 1/19/2021 at 11:33 PM, canjianfei said:

I wanted to make a script that could search for three numbers and change them to different values.

Here is my code:

gg.searchNumber (“ 1462; 46; 84”,gg.TYPE_DOUBLE,false,gg.SIGN_ EQUAL ,0,-1,0)
gg.getResults(3)
gg.editALL(“ 50000; 5000; 1000”,gg。 TYPE_DOUBLE)

Setting a proper memory range (say if these three values were in the Anonymous memory range then add a gg.setRanges before your search) this will severely reduce the number of results that turn up. Secondly the gg.getResults shouldn't be limited to 3 you will more than likely be returned the wrong values. Return it to the default 100 or around the same number of results you're returned without the script. These are what I believe are preventing your script from editing the proper values @canjianfei assuming that you already have a menu set up to execute the code.

Link to comment
Share on other sites

  • 1 month later...
  • 1 month later...

Hello

I want to make two groups number change to different number.

But this gameguardian can't work.

My code is that:

function Main0()
SN = gg.choice({
     "hello",
}, nil, "我是一个默默无闻的公告")
if SN==1 then
     Main2()
end
FX1=0
end

function Main2()
SN = gg.multiChoice({
     "德意志",
     "z20/z21",
}, nil, "")
if SN==1 then
     HS3()
end
if SN==2 then
     HS4()
end
FX1=0
end

function HS3()
     gg.clearResults()
     gg.setRanges(32)
     gg.searchNumber("691;56;41;29;65;7::", gg.TYPE_DOUBLE, false, gg.SIGN_EQUAL, 0, -1)
     gg.searchNumber("691;56;41;29;65;7", gg.TYPE_DOUBLE, false, gg.SIGN_EQUAL, 0, -1)
     gg.getResults(100)
     gg.editAll("8888888;8000;6000;15000;25000;6000", gg.TYPE_DOUBLE)
     gg.toast("cg1")
     gg.clearResults()
end

function HS4()
     gg.clearResults()
     gg.setRanges(32)
     gg.searchNumber("324;12;83;27;72;55:: ", gg.TYPE_DOUBLE, false, gg.SIGN_EQUAL, 0, -1)
     gg.searchNumber("324;12;83;27;72;55", gg.TYPE_DOUBLE, false, gg.SIGN_EQUAL, 0, -1)
     gg.getResults(100)
     gg.editAll("888888;1200;2000;3000;25000;6000", gg.TYPE_DOUBLE)
     gg.toast("cg2")
     gg.clearResults()
end

while true do
if gg.isVisible(true) then
    FX1 = nil
    gg.setVisible(false)
  end
  if FX1 == nil then
    Main0()
  end
end

新建文本文档.lua

Link to comment
Share on other sites

5 hours ago, canjianfei said:

Hello

I want to make two groups number change to different number.

But this gameguardian can't work.

My code is that:

function Main0()
SN = gg.choice({
     "hello",
}, nil, "我是一个默默无闻的公告")
if SN==1 then
     Main2()
end
FX1=0
end

function Main2()
SN = gg.multiChoice({
     "德意志",
     "z20/z21",
}, nil, "")
if SN==1 then
     HS3()
end
if SN==2 then
     HS4()
end
FX1=0
end

function HS3()
     gg.clearResults()
     gg.setRanges(32)
     gg.searchNumber("691;56;41;29;65;7::", gg.TYPE_DOUBLE, false, gg.SIGN_EQUAL, 0, -1)
     gg.searchNumber("691;56;41;29;65;7", gg.TYPE_DOUBLE, false, gg.SIGN_EQUAL, 0, -1)
     gg.getResults(100)
     gg.editAll("8888888;8000;6000;15000;25000;6000", gg.TYPE_DOUBLE)
     gg.toast("cg1")
     gg.clearResults()
end

function HS4()
     gg.clearResults()
     gg.setRanges(32)
     gg.searchNumber("324;12;83;27;72;55:: ", gg.TYPE_DOUBLE, false, gg.SIGN_EQUAL, 0, -1)
     gg.searchNumber("324;12;83;27;72;55", gg.TYPE_DOUBLE, false, gg.SIGN_EQUAL, 0, -1)
     gg.getResults(100)
     gg.editAll("888888;1200;2000;3000;25000;6000", gg.TYPE_DOUBLE)
     gg.toast("cg2")
     gg.clearResults()
end

while true do
if gg.isVisible(true) then
    FX1 = nil
    gg.setVisible(false)
  end
  if FX1 == nil then
    Main0()
  end
end

新建文本文档.lua 1.14 kB · 2 downloads

新建文本文档[FIXED].lua

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.