Jump to content

M_JuJu

Members
  • Posts

    4
  • Joined

  • Last visited

Posts posted by M_JuJu

  1. 1 hour ago, Double_D said:

    this throws an error: table expected for set index ('address') value, got nil

    if i alert the value of address, it shows a decimal number

    If you look a few post above for my script I'm pretty sure you can just copy part if it as that's the same mistake I was making. Basically after you've gotten the results and all, or if you know the specific address just do: 

    ...
    t = gg.getResults(1)
    addrs = t[1].address + 245628
    t[2] = {}
    t[2].address = addrs
    t[2].flags = gg.TYPE_DWORD
    t[2].value = 'new value'
    ...
    -- then finish with
    gg.addListItems(t)

    You can add in the freeze and such if needed, then voila (or at least I think - I'm also a noob, but this should work).

  2. Looks like I've finally (kind of) figured it out. I think part of what I was doing wrong was not initializing a[2] as a table, and trying to do the math to change the address while defining it. I'm sure there's a far simpler way to achieve what I was trying to do, but having created my first successful GG script I feel pleased ?

     

    if gg.isVisible() then gg.setVisible(false) end 
    newgame = gg.alert('Have you restarted the level?', 'Yes', 'No') 
    if newgame == 2 then
      gg.toast.('Start fresh and try again!'
      os.exit() 
    end 
    
    --initial search
    gg.processPause() 
    gg.searchNumber('0', gg.TYPE_DWORD, false, gg.SIGN_EQUAL) 
    gg.toast('Results: '..gg.getResultCount()) 
    
    gg.processResume() 
    
    while gg.getResultCount() > 1 do 
       gg.toast('Cause an accident!') 
       gg.sleep(5000) 
       gg.processPause() 
       acc = gg.alert('Did you crash some vehichles?', 'Yes', 'No') 
       if acc == 2 then 
          gg.searchFuzzy() 
       else 
          gg.searchFuzzy('0', gg.SIGN_FUZZY_LESS) 
       end 
       gg.processResume() 
    end 
    
    --[[
    if gg.getResultCount() <10 then 
       while gg.getResultCount() > 1 do 
          gg.searchNumber('0~-10000', gg.TYPE_DWORD, false, gg.SIGN_EQUAL)
       end 
    end 
    ]]--
      
    gg.toast('Results narrowed to: '.. gg.getResultCount()) 
    a = gg.getResults(1) 
    a[1].value = '0' 
    a[1].freeze = true
    cn = a[1].address - 4
    rn = a[1].address + 4
    c = {}
    c[1] = {}
    c[1].flags = gg.TYPE_DWORD
    c[1].address = cn
    c[1].value = '85'
    c[1].freeze = true
    c[1].freezeType = gg.FREEZE_MAY_INCREASE
    c[2] = {}
    c[2].flags = gg.TYPE_DWORD
    c[2].address = rn
    c[2].value = '0'
    c[2].freeze = true
    c[2].freezeType = gg.FREEZE_NORMAL
    gg.addListItems(a)
    gg.addListItems(c)
    print('Cars: '..c[1].address)
    print('Traffic: '..c[2].address)
    --gg.clearResults()

    One thing I can't figure out is how to filter results by value. I tried searching by number after the fuzzy search, for anything between 0 to -10000(like the searchNumber() examples show for positive numbers) using SIGN_EQUAL or SIGN_GREATER but it kept getting stuck in the while loop with two results, the desired one and one that was always around -1,000,000 which I was hoping to filter out. 

    Thanks again for your help, and all of your dedication to this project, it's greatly appreciated!

  3. 26 minutes ago, Enyby said:

    It is decimal number. In GG it show as hex.

    Ah thank you! I just realized that after thinking to check it in a converter -_- 

    So does that mean I can simply create a new item in the table and do

    a[2].address = a[1].address - 4
    a[2].value = 0
    etc.
    gg.addListItems(a) 

    To go from the original address from the search results(example: 343739CC) to 343739C8 and change that value to 0, or do I need to somehow convert the hexadecimal address or use gg.setValues () or something?

  4. This may be a stupid question as I'm not really familiar with half of this stuff, but when you've completed a search and do:

    a = gg.getResults(1)
    print(a[1].address)

    Should it print the same address that you see remaining in the results list in the UI, or does it use some other number?  Thanks in advance, and again, sorry if this is incredibly obvious!

    Screenshot_2018-10-27-00-26-47.png

×
×
  • 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.