Jump to content

Question

Posted (edited)

Hi I'm trying to make a simple script for a game and its working : ) but I want to add a button to reset all the changes I've done but I dont know the code for it so can someone help me 

Thanks

Edited by Noobhoch12

Recommended Posts

  • 0
  • Moderators
Posted
21 minutes ago, Noobhoch12 said:

I don't understand why it's not correct the first function is working and the second is working if it is the same search number like the first one

You put:

your_values2[9].value1 = 5000

Correct:

your_values2[9].value = 5000

 

  • 0
Posted (edited)
28 minutes ago, Noobhoch12 said:

I don't understand why it's not correct the first function is working and the second is working if it is the same search number like the first one

Hi! The problem is on .value1 while it's should be just .value; it's hardcoded function not a variable. Change it to this:
 

your_values2[1].value = 5000 
your_values2[6].value = 5000
your_values2[9].value = 5000

 

Edited by MainC
  • 0
Posted
30 minutes ago, MainC said:

Hi! The problem is on .value1 while it's should be just .value; it's hardcoded function not a variable. Change it to this:
 

your_values2[1].value = 5000 
your_values2[6].value = 5000
your_values2[9].value = 5000

 

 

 if menu== 1 then
      gg.setRanges(gg.REGION_ANONYMOUS)
      gg.searchNumber('195;0;2;0;0::100',gg.TYPE_DOUBLE)
     your_values= gg.getResults(100)
          your_values[1].value = 5000 
         your_values[9].value = 5000
          your_values[12].value = 5000
          gg.setValues(your_values)
  gg.clearResults()
       gg.toast("done")

    end

  

     

      if menu== 2 then
        gg.setRanges(gg.REGION_ANONYMOUS)
      gg.searchNumber('184;10;2;0;0::100',gg.TYPE_DOUBLE)
      your_values2= gg.getResults(100)
      your_values2[1].value = 5000 
     your_values2[4].value = 5000
      your_values2[5].value = 5000
      gg.setValues(your_values2)
       gg.toast("done")
      end

I've tested it with 

your_values2[1].value = 5000 
your_values2[6].value = 5000
your_values2[9].value = 5000

but it still gives me this error code

Skript beendet:
Skriptfehler.: luaj.o: /storage/emulated/0/Apps/test.lua:35
`      your_values2[1].value = 5000 `
table expected for set index ('value') value, got nil (field '1')
level = 1, const = 37, proto = 1, upval = 1, vars = 6, code = 122
SETTABLE v0 "value" 5000
 ; PC 86 CODE 8AC5800A OP 10 A 0 B 277 C 278 Bx 142102 sBx 11031
stack traceback:
	/storage/emulated/0/Apps/test.lua:35 in main chunk
	[Java]: in ?
	at luaj.LuaValue.d(src:2795)
	at luaj.LuaValue.b(src:1123)
	at luaj.LuaClosure.a(src:383)
	at luaj.LuaClosure.l(src:160)
	at android.ext.Script.d(src:6056)
	at android.ext.Script$ScriptThread.run(src:5785)

I have no idea why  (I'm from germany and sry if you can't understand this error)

  • 0
  • Moderators
Posted
6 hours ago, Noobhoch12 said:

 

 if menu== 1 then
      gg.setRanges(gg.REGION_ANONYMOUS)
      gg.searchNumber('195;0;2;0;0::100',gg.TYPE_DOUBLE)
     your_values= gg.getResults(100)
          your_values[1].value = 5000 
         your_values[9].value = 5000
          your_values[12].value = 5000
          gg.setValues(your_values)
  gg.clearResults()
       gg.toast("done")

    end

  

     

      if menu== 2 then
        gg.setRanges(gg.REGION_ANONYMOUS)
      gg.searchNumber('184;10;2;0;0::100',gg.TYPE_DOUBLE)
      your_values2= gg.getResults(100)
      your_values2[1].value = 5000 
     your_values2[4].value = 5000
      your_values2[5].value = 5000
      gg.setValues(your_values2)
       gg.toast("done")
      end

I've tested it with 

your_values2[1].value = 5000 
your_values2[6].value = 5000
your_values2[9].value = 5000

but it still gives me this error code

Skript beendet:
Skriptfehler.: luaj.o: /storage/emulated/0/Apps/test.lua:35
`      your_values2[1].value = 5000 `
table expected for set index ('value') value, got nil (field '1')
level = 1, const = 37, proto = 1, upval = 1, vars = 6, code = 122
SETTABLE v0 "value" 5000
 ; PC 86 CODE 8AC5800A OP 10 A 0 B 277 C 278 Bx 142102 sBx 11031
stack traceback:
	/storage/emulated/0/Apps/test.lua:35 in main chunk
	[Java]: in ?
	at luaj.LuaValue.d(src:2795)
	at luaj.LuaValue.b(src:1123)
	at luaj.LuaClosure.a(src:383)
	at luaj.LuaClosure.l(src:160)
	at android.ext.Script.d(src:6056)
	at android.ext.Script$ScriptThread.run(src:5785)

I have no idea why  (I'm from germany and sry if you can't understand this error)

You need clear before make another search, and also make sure that GG are finding that group search. You need use gg.clearResults() always at the function start, works for me.

 

  • 0
Posted
13 hours ago, Noobhoch12 said:

 

 if menu== 1 then
      gg.setRanges(gg.REGION_ANONYMOUS)
      gg.searchNumber('195;0;2;0;0::100',gg.TYPE_DOUBLE)
     your_values= gg.getResults(100)
          your_values[1].value = 5000 
         your_values[9].value = 5000
          your_values[12].value = 5000
          gg.setValues(your_values)
  gg.clearResults()
       gg.toast("done")

    end

  

     

      if menu== 2 then
        gg.setRanges(gg.REGION_ANONYMOUS)
      gg.searchNumber('184;10;2;0;0::100',gg.TYPE_DOUBLE)
      your_values2= gg.getResults(100)
      your_values2[1].value = 5000 
     your_values2[4].value = 5000
      your_values2[5].value = 5000
      gg.setValues(your_values2)
       gg.toast("done")
      end

I've tested it with 

your_values2[1].value = 5000 
your_values2[6].value = 5000
your_values2[9].value = 5000

but it still gives me this error code

Skript beendet:
Skriptfehler.: luaj.o: /storage/emulated/0/Apps/test.lua:35
`      your_values2[1].value = 5000 `
table expected for set index ('value') value, got nil (field '1')
level = 1, const = 37, proto = 1, upval = 1, vars = 6, code = 122
SETTABLE v0 "value" 5000
 ; PC 86 CODE 8AC5800A OP 10 A 0 B 277 C 278 Bx 142102 sBx 11031
stack traceback:
	/storage/emulated/0/Apps/test.lua:35 in main chunk
	[Java]: in ?
	at luaj.LuaValue.d(src:2795)
	at luaj.LuaValue.b(src:1123)
	at luaj.LuaClosure.a(src:383)
	at luaj.LuaClosure.l(src:160)
	at android.ext.Script.d(src:6056)
	at android.ext.Script$ScriptThread.run(src:5785)

I have no idea why  (I'm from germany and sry if you can't understand this error)

Your script working fine but the problem is on search value. The script unable to find result at Index 1 according to this:
 

Quote

table expected for set index ('value') value, got nil (field '1')

Are you really sure you got the correct one? Values can be dynamic or based on Game Session.

  • 0
Posted
2 hours ago, MainC said:

Your script working fine but the problem is on search value. The script unable to find result at Index 1 according to this:
 

Are you really sure you got the correct one? Values can be dynamic or based on Game Session.

yes I added in the code 

 gg.searchNumber('184;10;2,9;0;0::100',gg.TYPE_DOUBLE)

but 2,9 is fo some reason 29,0 so I changed the , to . and it's working now thanks for helping (my mistake)

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.