Forum in READ ONLY mode! All questions and discussions on Discord official server, invite link: https://discord.gg/VxsGzJ7

[Python] NumGumpButton, ReturnValue from ElemNum (solved)

Ask for help
Post Reply
sauber
Neophyte
Neophyte
Posts: 18
Joined: 18.07.2018 21:01

[Python] NumGumpButton, ReturnValue from ElemNum (solved)

Post by sauber »

Hi Guys,

I'm inspecting a Gump and a Button.

The problem is that every time this Gump is opened, or I change page. The value of ReturnValue changes

I only want ElemNum 13's ReturnValue

Code: Select all

 'GumpButtons': [{'ElemNum': 1, 'Page': 0, 'PageID': 0, 'PressedID': 22153, 'Quit': 1, 'ReleasedID': 22153, 'ReturnValue': 2488, 'X': 5, 'Y': 5},
                 {'ElemNum': 2, 'Page': 0, 'PageID': 0, 'PressedID': 2435, 'Quit': 1, 'ReleasedID': 2435, 'ReturnValue': 18369, 'X': 30, 'Y': 9},
                 {'ElemNum': 3, 'Page': 0, 'PageID': 0, 'PressedID': 2437, 'Quit': 1, 'ReleasedID': 2437, 'ReturnValue': 6405, 'X': 40, 'Y': 9},
                 {'ElemNum': 4, 'Page': 0, 'PageID': 0, 'PressedID': 1896, 'Quit': 1, 'ReleasedID': 1896, 'ReturnValue': 15019, 'X': 120, 'Y': 5},
                 {'ElemNum': 6, 'Page': 0, 'PageID': 0, 'PressedID': 1896, 'Quit': 1, 'ReleasedID': 1896, 'ReturnValue': 18606, 'X': 135, 'Y': 5},
                 {'ElemNum': 8, 'Page': 0, 'PageID': 0, 'PressedID': 1896, 'Quit': 1, 'ReleasedID': 1896, 'ReturnValue': 13612, 'X': 150, 'Y': 5},
                 {'ElemNum': 10, 'Page': 0, 'PageID': 0, 'PressedID': 1896, 'Quit': 1, 'ReleasedID': 1896, 'ReturnValue': 19094, 'X': 165, 'Y': 5},
                 {'ElemNum': 12, 'Page': 0, 'PageID': 0, 'PressedID': 9701, 'Quit': 1, 'ReleasedID': 9700, 'ReturnValue': 9537, 'X': 80, 'Y': 7},
                 {'ElemNum': 13, 'Page': 0, 'PageID': 0, 'PressedID': 9705, 'Quit': 1, 'ReleasedID': 9704, 'ReturnValue': 19695, 'X': 100, 'Y': 7},
Last edited by sauber on 24.11.2018 21:18, edited 1 time in total.
sauber
Neophyte
Neophyte
Posts: 18
Joined: 18.07.2018 21:01

Re: [Python] NumGumpButton, ReturnValue from ElemNum

Post by sauber »

This seems to work fine (I'm using 8.8.3 Stealth and Python2.7)

simply call the function with the Gump Index number and the Button ElemNum
even if the ReturnValue will change, this function will find it and hit the button for you

Code: Select all

def findReturnValue(gump_index, btnElemNum): 
   txt = GetGumpInfo(gump_index) 
   Wait(10)      
   for dicts in txt['GumpButtons']:
      if dicts['ElemNum'] == btnElemNum:
         NumGumpButton(gump_index,dicts['ReturnValue']) 
nah nah
Developer
Developer
Posts: 414
Joined: 13.07.2011 11:23
Contact:

Re: [Python] NumGumpButton, ReturnValue from ElemNum (solved

Post by nah nah »

why 2.7?
sauber
Neophyte
Neophyte
Posts: 18
Joined: 18.07.2018 21:01

Re: [Python] NumGumpButton, ReturnValue from ElemNum (solved

Post by sauber »

When I started playing around with python 4 years ago, version 2.7 was more stable.
I took a long break and I didn’t research much about its development.
It should be fine with all other versions, it’s a really simple function.
Anyway hope this will help a lot of newbies!
Post Reply