Jump to content
  • 0

Attempt to call a nill value ( global 'name of function')


Question

Posted

Thanks for the support, I have another mistake. I have named a menu with 3 options, I choose the first one and I open a menu with the function dd.multiChoice, I choose the items I want to activate and give me this error. 

 

Script ended:

errore di script: luaj.o: /storage/emulated/0/qlua5/PSG2.2.lua:22

` if t[2] then hack2aa() end `

attempt to call a nil value (global 'hack2aa')

level = 1, const = 39, proto = 9, upval = 1, vars = 11, code = 97

CALL v1..v1

 ; PC 46 CODE 0080405D OP 29 A 1 B 1 C 1 Bx 513 sBx -130558

stack traceback:

 /storage/emulated/0/qlua5/PSG2.2.lua:22 in main chunk

 [Java]: in ?

 at luaj.LuaValue.a(src:2835)

 at luaj.LuaValue.Z(src:1966)

 at luaj.LuaValue.l(src:1393)

 at luaj.LuaClosure.a(src:533)

 at luaj.LuaClosure.l(src:160)

 at android.ext.Script.d(src:5988)

 at android.ext.Script$ScriptThread.run(src:5717)

Recommended Posts

  • 0
Posted (edited)

Function hack2aa is not exist in your script, maybe typo when calling it. How about showing your source code for more help?

Edited by ItsSC
  • 0
Posted

I don't understand why it makes me wrong... 

 

menu = gg.choice ({

  ' 👑 QT Menu 👑 ',

  ' 👑 QT Second Menu 👑 ', 

  ' ☢️ exit ☢️ '},nil,' Quark ThoNos')

  

  if menu == 1 then 

local t = gg.multiChoice({

  ' 🤖 Instant Boss 🤖 ',

  ' 🏃‍♂️ Speed Hack 🏃‍♂️ ',

  ' ⛏️ Fast Hit ⛏️ ', 

  ' 💲 Token Hack 💲 ', 

  ' 🧱 Wall Hack 🧱 ', 

  ' 🔭 Zoom Hack 🔭 ',

  ' 🗿 RoboMask Hack 🗿',

  ' 🔰Free Wooden Armor🔰 ',

  ' Range Hack', 

  },nil,' to subscribers')

 if t == nil then gg.sleep(1)

 else

  if t[1] then hack1aa() end 

  if t[2] then hack2aa() end 

  if t[3] then hack3aa() end 

  if t[4] then hack4aa() end

  if t[5] then hack5aa() end

  if t[6] then hack6aa() end

  if t[7] then hack7aa() end

  if t[8] then hack8aa() end

 end 

end

 

 

function hack1aa()

gg.searchNumber('180Q;180Q',gg.TYPE_QWORD)

gg.getResults('100')

gg.editAll('0',gg.TYPE_QWORD)

gg.clearResults() 

end 

 

function hack2aa()

gg.setSpeed(2)

end 

  • 0
Posted
9 minutes ago, QuarkYT said:

I don't understand why it makes me wrong... 

Lua read codes from first line to last line. 
For example : 

print(a)
a = 10 


output = nil (Lua can't read what is a because it didn't declare before printing it)
 

a=10
print(a)

output = 10 (Lua know a = 10 , so it print 10)

Spoiler

menu =
    gg.choice(
    {
        " 👑 QT Menu 👑 ",
        " 👑 QT Second Menu 👑 ",
        " ☢️ exit ☢️ "
    },
    nil,
    " Quark ThoNos"
)

if menu == 1 then
    local t =
        gg.multiChoice(
        {
            " 🤖 Instant Boss 🤖 ",
            " 🏃‍♂️ Speed Hack 🏃‍♂️ ",
            " ⛏️ Fast Hit ⛏️ ",
            " 💲 Token Hack 💲 ",
            " 🧱 Wall Hack 🧱 ",
            " 🔭 Zoom Hack 🔭 ",
            " 🗿 RoboMask Hack 🗿",
            " 🔰Free Wooden Armor🔰 ",
            " Range Hack"
        },
        nil,
        " to subscribers"
    )

    if t == nil then
        gg.sleep(1)
    else
        if t[1] then
            hack1aa()
        end

        if t[2] then
            hack2aa()
        end

        if t[3] then
            hack3aa()
        end

        if t[4] then
            hack4aa()
        end

        if t[5] then
            hack5aa()
        end

        if t[6] then
            hack6aa()
        end

        if t[7] then
            hack7aa()
        end

        if t[8] then
            hack8aa()
        end
    end
end

 

So you just move this entire thing to the end of the script. Then everything is fine.

  • 0
Posted

I think it works, but when I start and click the first menu, I click the options I want to activate tells me script ended :

menu = gg.choice ({

  ' 👑 QT Menu 👑 ',

  ' 👑 QT Second Menu 👑 ', 

  ' ☢️ exit ☢️ '},nil,' Quark ThoNos')

  

  if menu == 1 then

 

local t = gg.multiChoice({

  ' 🤖 Instant Boss 🤖 ',

  ' 🏃‍♂️ Speed Hack 🏃‍♂️ ',

  ' ⛏️ Fast Hit ⛏️ ', 

  ' 💲 Token Hack 💲 ', 

  ' 🧱 Wall Hack 🧱 ', 

  ' 🔭 Zoom Hack 🔭 ',

  ' 🗿 RoboMask Hack 🗿',

  ' 🔰Free Wooden Armor🔰 ',

  ' Range Hack', 

  },nil,' to subscribers')

end

 

function hack1aa()

gg.searchNumber('180Q;180Q',gg.TYPE_QWORD)

gg.getResults('100')

gg.editAll('0',gg.TYPE_QWORD)

gg.clearResults() 

end 

 

function hack2aa()

gg.setSpeed(2)

end 

 

function hack3aa()

gg.alert('Hi')

end

 

function hack4aa()

gg.alert('Hi')

end

 

function hack5aa()

gg.alert('Hi')

end

 

function hack6aa() 

gg.alert('Hi') 

end

 

function hack7aa()

gg.alert('Hi') 

end

 

function hack8aa() 

gg.alert('Hi')

end

 

if t == nil then gg.sleep(1)

 else

  if t[1] then hack1aa() end 

  if t[2] then hack2aa() end 

  if t[3] then hack3aa() end 

  if t[4] then hack4aa() end

  if t[5] then hack5aa() end

  if t[6] then hack6aa() end

  if t[7] then hack7aa() end

  if t[8] then hack8aa() end

 end 

  • 0
Posted (edited)

Your code is quite messy. 
Re-edit version:

function hack1aa()
    gg.searchNumber("180Q;180Q", gg.TYPE_QWORD)
    gg.getResults("100")
    gg.editAll("0", gg.TYPE_QWORD)
    gg.clearResults()
end

function hack2aa()
    gg.setspeed(2)
end

function hack3aa()
    gg.alert("Hi")
end

function hack4aa()
    gg.alert("Hi")
end

function hack5aa()
    gg.alert("Hi")
end

function hack6aa()
    gg.alert("Hi")
end

function hack7aa()
    gg.alert("Hi")
end

function hack8aa()
    gg.alert("Hi")
end

function first_Menu()
    local t =
        gg.multiChoice(
        {
            "  Instant Boss  ",
            "  Speed Hack  ",
            "  Fast Hit  ",
            "  Token Hack  ",
            "  Wall Hack  ",
            "  Zoom Hack  ",
            "  RoboMask Hack ",
            " Free Wooden Armor ",
            " Range Hack"
        },
        nil,
        " to subscribers"
    )

    if t == nil then
        gg.sleep(1)
    else
        if t[1] then
            hack1aa()
        end
        if t[2] then
            hack2aa()
        end
        if t[3] then
            hack3aa()
        end
        if t[4] then
            hack4aa()
        end
        if t[5] then
            hack5aa()
        end
        if t[6] then
            hack6aa()
        end
        if t[7] then
            hack7aa()
        end
        if t[8] then
            hack8aa()
        end
    end
end

function main()
    local menu =
        gg.choice(
        {
            "  QT Menu  ",
            "  QT Second Menu  ",
            "  exit  "
        },
        nil,
        " Quark ThoNos"
    )
    if menu == 1 then
        first_Menu()
    elseif menu == 2 then
        second_Menu()
    elseif menu == 3 then
        os.exit()
    end
end

main() 

 

Edited by ItsSC
Forgot to call the main() function
  • 0
Posted

Bro, Sorry to bother, but I still have one more problem. If you have time of course. 

So when in the script I create the second menu, with the function that you gave me, second_Menu, the script reads it. Then I go into the second menu, where there is another menu, and when I click the first option tells me script ended. 

 

function second_Menu() 

 

local names = gg.choice({

 

'🛸Change Slime into Ghost Boss👻 [HARD] ',

'🗡️Duplicate Items⚔️',

'🔥Damage/HP💪🏻',

'🏹Legendary Items from Trees📀 [HARD]'},nil, "QT")

 

end

 

if names ==1 then

gg.alert('Hi') 

end

 

if names ==2 then

gg.alert('hi') 

end

 

if names ==3 then

gg.alert('hi') 

end

 

function main()

    local menu =

        gg.choice(

        {

             ' 👑 QT Menu 👑 ',

  ' 👑 QT Second Menu 👑 ', 

  ' ☢️ exit ☢️ '

        },

        nil,

        " Quark ThoNos"

    )

    if menu == 1 then

        first_Menu()

    elseif menu == 2 then

        second_Menu()

    elseif menu == 3 then

        os.exit()

    end

end 

 

main() 

  • 0
Posted
25 minutes ago, QuarkYT said:

Yes thank so much. All Game Guardian comunity thanks! 

another one for you..

TEST_QTmenu.lua

study the script...just so you can learn the many ways to make it work.

  • 0
Posted
9 hours ago, QuarkYT said:

Bro, Sorry to bother, but I still have one more problem. If you have time of course. 

So when in the script I create the second menu, with the function that you gave me, second_Menu, the script reads it. Then I go into the second menu, where there is another menu, and when I click the first option tells me script ended. 

Since you get the answer but yet you still get an error. I see what you did wrong there. You don't really understand when to add "end" in the script.

Remember, only add end when you want to close a function / for loop/ while loop.

function main()
    -- Do anything you want here, let's move back to your example
    local names =
        gg.choice(
        {
            "🛸Change Slime into Ghost Boss👻 [HARD] ",
            "🗡️Duplicate Items⚔️",
            "🔥Damage/HP💪🏻",
            "🏹Legendary Items from Trees📀 [HARD]"
        },
        nil,
        "QT"
    )
end

You ended the function in this very weird situation. What the script know is
"Hey, let's call the second_Menu function"

Script: There's only gg.choice() function inside this function. If you press any button, nothing triggered. 

Obviously, you want those button correspond to their individual function. So do not stop at here, keep move on.

function main()
    -- Do anything you want here, let's move back to your example
    local names =
        gg.choice(
        {
            "🛸Change Slime into Ghost Boss👻 [HARD] ",
            "🗡️Duplicate Items⚔️",
            "🔥Damage/HP💪🏻",
            "🏹Legendary Items from Trees📀 [HARD]"
        },
        nil,
        "QT"
    )
if names ==1 then
gg.alert('Hi') 
end

if names ==2 then
gg.alert('hi') 
end
 
if names ==3 then
gg.alert('hi') 
end
  
end

Now, when you press the first button, it will go to names == 1, if you press 2, it goes to names == 2 and so on.

  • 0
Posted

Thank you so much. I like you. I want to learn .lualanguage but is not very easy. For example is not equal as C++ language.

  • 0
Posted
18 minutes ago, QuarkYT said:

Thank you so much. I like you. I want to learn .lualanguage but is not very easy. For example is not equal as C++ language.

Wait... C++ is tougher than lua. At least you don't have to declare what type of the variable is 
For example 
C++:

int a = 1;
string b = "text";
char c = "A";
float d = 1.23;

Meanwhile 
Lua:

a = 1;
b = "text";
c = "A";
d = 1.23;

 

  • 0
Posted

Fra, Sorry the disturbance, I was interested to know if there is a command to wrap from one sentence to another, for example in C. or I'll add the n at the end of the sentence. Is it possible to do this on game guardian? 

 

local menu = gg.choice ({

 

 ' 👑 QT Menu 👑 ',

  ' 👑 QT Second Menu 👑 ', 

  ' ☢️ exit ☢️ '

 

},nil,'╔═════ஜ۩۞۩ஜ═════╗ ╚═════ஜ۩۞۩ஜ═════╝')

  • 0
Posted
58 minutes ago, QuarkYT said:

Fra, Sorry the disturbance, I was interested to know if there is a command to wrap from one sentence to another, for example in C. or I'll add the n at the end of the sentence. Is it possible to do this on game guardian? 

 

local menu = gg.choice ({

 

 ' 👑 QT Menu 👑 ',

  ' 👑 QT Second Menu 👑 ', 

  ' ☢️ exit ☢️ '

 

},nil,'╔═════ஜ۩۞۩ஜ═════╗ ╚═════ஜ۩۞۩ஜ═════╝')

you mean std::endl? If it then \n in lua.

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.