Jump to content
  • 0

Noobhoch12
 Share

Question

Recommended Posts

  • 0
  • Moderators
16 hours ago, Noobhoch12 said:

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

Try this way.

-- This is a sample code.
function your_function()
  	gg.setRanges(gg.REGION_ANONYMOUS)
	gg.searchNumber("15.3242816925", gg.TYPE_FLOAT, false, gg.SIGN_EQUAL, 0, -1, 0)
	original_values = gg.getResults(1000, nil, nil, nil, nil, nil, nil, nil, nil) -- Here will save the original values before the edit.
    	gg.editAll("1", gg.TYPE_FLOAT)
  	gg.clearResults()
end
--
function revert_to_original()
  gg.setValues(original_values)
end

 

Edited by Collen
Link to comment
Share on other sites

  • 0

Thanks im testing this but i have another question for example if I get like 10 results and I only want to edit the 3rd (starting from the top) and the 7th one how do I make the code for it to only edit these two?

Edited by Noobhoch12
Link to comment
Share on other sites

  • 0
  • Moderators
16 minutes ago, Noobhoch12 said:

Thanks im testing this but i have another question for example if I get like 10 results and I only want to edit the 3rd (starting from the top) and the 7th one how do I make the code for it to only edit these two?

Maybe this works.

function your_function()
	gg.setRanges(gg.REGION_ANONYMOUS)
	gg.searchNumber("10~999", gg.TYPE_FLOAT, false, gg.SIGN_EQUAL, 0, -1, 0)
	your_values = gg.getResults(1000, nil, nil, nil, nil, nil, nil, nil, nil)
	your_values[2].value = 23 -- [2] It's the index of your value.
	gg.setValues(your_values)
	gg.clearResults()
end

 

Link to comment
Share on other sites

  • 0
28 minutes ago, Collen said:

Maybe this works.

function your_function()
	gg.setRanges(gg.REGION_ANONYMOUS)
	gg.searchNumber("10~999", gg.TYPE_FLOAT, false, gg.SIGN_EQUAL, 0, -1, 0)
	your_values = gg.getResults(1000, nil, nil, nil, nil, nil, nil, nil, nil)
	your_values[2].value = 23 -- [2] It's the index of your value.
	gg.setValues(your_values)
	gg.clearResults()
end

 

Idk if only don't understand it or I just don't had explained it right:

For example 

 gg.searchNumber('195;0;2;0;0::95',gg.TYPE_DOUBLE)

gg.getResults(50)

I know that the 1st 0 of the results will crash the game if i edit all so i dont want to edit this 0 but the next 0 I want to edit and the next one and the 195.... 

image.thumb.png.51ce36ab2d245b2eceef5f90eab6d8eb.png

Link to comment
Share on other sites

  • 0
  • Moderators
19 minutes ago, Noobhoch12 said:

Idk if only don't understand it or I just don't had explained it right:

For example 

 gg.searchNumber('195;0;2;0;0::95',gg.TYPE_DOUBLE)

gg.getResults(50)

I know that the 1st 0 of the results will crash the game if i edit all so i dont want to edit this 0 but the next 0 I want to edit and the next one and the 195.... 

image.thumb.png.51ce36ab2d245b2eceef5f90eab6d8eb.png

I think you didn't understand very well. What you need to do now is repeat the process and change the index as you wish.

Link to comment
Share on other sites

  • 0
4 minutes ago, Collen said:

I think you didn't understand very well. What you need to do now is repeat the process and change the index as you wish.

so I need to paste in the index wich values (starting from the top) I want to change?For example in the index [2,5,9...]

Edited by Noobhoch12
Link to comment
Share on other sites

  • 0
  • Moderators
Just now, Noobhoch12 said:

so I need to paste in the index wich values (starting from the top) I want to change?

Yeah, and make sure that the index don't change when you restart the game, otherwise this form will not be useful.

function your_function()
	gg.setRanges(gg.REGION_ANONYMOUS)
	gg.searchNumber("10~999", gg.TYPE_FLOAT, false, gg.SIGN_EQUAL, 0, -1, 0)
	your_values = gg.getResults(1000, nil, nil, nil, nil, nil, nil, nil, nil)
	your_values[3].value = 323 -- [3] It's the index of your value.
	your_values[7].value = 9
	your_values[9].value = 3
	gg.setValues(your_values)
	gg.clearResults()
end

 

Link to comment
Share on other sites

  • 0
3 minutes ago, Collen said:

No need to use editAll, the edited values are being passed on:

your_values[9].value = 3 -- 3 It's the edited value.

 

that means the index is the number starting from the top?!

ok thanks for helping I think I need help again sometime : )

Link to comment
Share on other sites

  • 0
  • Moderators
3 minutes ago, Noobhoch12 said:

that means the index is the number starting from the top?!

Sure.

 

3 minutes ago, Noobhoch12 said:

ok thanks for helping I think I need help again sometime : )

Really need. I recommend that you try to understand how it works, and maybe read some of the GG documentation.

Link to comment
Share on other sites

  • 0

I have another question for example if I'm using 
this code:
 

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,9;0;0::100',gg.TYPE_DOUBLE)
     your_values2= gg.getResults(100)
          your_values2[1].value1 = 5000 
         your_values2[6].value1 = 5000
          your_values2[9].value1 = 5000
          gg.setValues(your_values2)
  gg.clearResults()
       gg.toast("done")
      end

i cant use it twice so i mean the first function is working (menu == 1 but the secount one gives me every time a error but if I'm changing the search number to the same like in menu 1 its working but thats not help me

Link to comment
Share on other sites

  • 0
  • Moderators
10 minutes ago, Noobhoch12 said:

I have another question for example if I'm using 
this code:
 

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,9;0;0::100',gg.TYPE_DOUBLE)
     your_values2= gg.getResults(100)
          your_values2[1].value1 = 5000 
         your_values2[6].value1 = 5000
          your_values2[9].value1 = 5000
          gg.setValues(your_values2)
  gg.clearResults()
       gg.toast("done")
      end

i cant use it twice so i mean the first function is working (menu == 1 but the secount one gives me every time a error but if I'm changing the search number to the same like in menu 1 its working but thats not help me

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

.value It's not correct. Try again

Link to comment
Share on other sites

  • 0
35 minutes ago, Collen said:

.value It's not correct. Try again

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

Edited by Noobhoch12
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.