Author Topic: Rapid Use of exevent popup causes it to break?  (Read 2898 times)

0 Members and 1 Guest are viewing this topic.

Offline AlphaTopic starter

  • Hero Member
  • *
  • Posts: 583
  • Activity:
    0%
  • Reputation Power: 10
  • Alpha barely matters.Alpha barely matters.
  • Respect: +44
  • Referrals: 0
    • View Profile
Rapid Use of exevent popup causes it to break?
« on: February 02, 2011, 10:49:18 PM »
0
So I'm working on something that rapidly uses context menus & it seems that exevent popup just simply fails to open ANY context menu in some cases.  I know the ID of the item to open a context menu on is correct but beyond that I'm totally confused....    Anyone else experience this?

Offline Khameleon

  • Script Tester - Team Leader
  • Elite
  • *
  • *
  • Posts: 2574
  • Activity:
    0%
  • Reputation Power: 30
  • Khameleon is a rising star!Khameleon is a rising star!Khameleon is a rising star!Khameleon is a rising star!Khameleon is a rising star!Khameleon is a rising star!
  • Gender: Male
  • Respect: +238
  • Referrals: 0
    • View Profile
Re: Rapid Use of exevent popup causes it to break?
« Reply #1 on: February 02, 2011, 10:52:16 PM »
0
are you also waiting to check for the GUMP window size and type?


most of use a sub something like this

Code: [Select]
;-------------------------------------------------------------------------------
; %1 = GumpSize
; %2 = Gumpname
; #TRUE gump occured before timeout
sub GumpWait1
  namespace push
  namespace local GW
  wait 10
  set !timedelay #SCNT
  while #SCNT <= !timedelay + 7
  {
    if #CONTSIZE = %1 || #CONTNAME = %2
    {
      namespace pop
      return #TRUE
    }
  }
  namespace pop
return #FALSE

Offline AlphaTopic starter

  • Hero Member
  • *
  • Posts: 583
  • Activity:
    0%
  • Reputation Power: 10
  • Alpha barely matters.Alpha barely matters.
  • Respect: +44
  • Referrals: 0
    • View Profile
Re: Rapid Use of exevent popup causes it to break?
« Reply #2 on: February 03, 2011, 10:22:09 AM »
0
Yea Kham I am.. I was working on Something to set the security of my plants...  The problem I'm having is that line 73 (Gosub Wait_for_gump) gets stuck in an infinite loop bc when it Returns #false it does a GOTO that performs exevent popup AGAIN...  but exevent popup NEVER generates a context menu on the plant.   I ended up arbitrarily adding the %wait Variable to fix the problem but I don't see WHY I need it.
Code: [Select]
;----------------------------------
;-----------USER CONFIG------------
set %Wait 1
;--Setting %wait to 5 works for me..(but I don't see why ANY wait is needed) Try 5 / 10 / 15 beyond that if it hangs & stops working.
set %Security 5
;-- 1 = Owner
;-- 2 = Co-Owner
;-- 3 = Friends
;-- 4 = Guild Members
;-- 5 = Anyone
;----------------------------------
;----------------------------------

;--The following list of plant types is probably FAR from complete so be aware of that = )

set %plantlist OLI_BCF_VWE_BWE_UAF_JWE_IWE_EXE_UWE_ICF_BXE_YVE_CCF_NWE_MWE_DXE_TCF_NXE_BKP_ZJP_MKP_AKP_CKP_
+OKP_NKP_SVE_QVE_AIF_ISN_FWE_WTE_ZBF_VWE_GWE_WEK_CYE_JDE_NTE_QLI_WWE_WVE_BFK_LKP

;---set %dirt_bowl QLI
;--Empty Bowl DGI
;--OLI is Green Bowls

START:

Finditem %Plantlist
If #findcnt = 0
  {
    Display ok All plants that were Found have been Hidden.  Get the "findtype" of plants still Visible & Add to "plantlist" Variable
    + Leave & Re-Enter your House to Reveal hidden plants. $
    + Script Halted!
    Halt
  }
set %Total_plants #findcnt
event sysmessage Number of Plants Left = %Total_plants
Gosub Security #findid %Security
Hideitem #findid
wait %Wait

Goto START
;-------------------------------------
Sub Click_offset
If %0 <> 2
  {
    Display ok Halted. %1 = X %2 = Y
    halt
  }
set %Click_X #contposX + %1
set %Click_Y #contposY + %2
click %Click_X %Click_Y
Return
;-------------------------------------
Sub Wait_For_Gump
;--%1 = #Contname | %2 = #contsize | %3 = timeout in Seconds
set %timeout #scnt + %3
While #contname <> %1 && #contsize <> %2 && #scnt < %timeout
  {
    wait 1
  }
If #scnt < %timeout
  Return #True
Else
  Return #False
;----------------------------------------
Sub Security
;--%1 ITEM ID to Open Context Menu Of
;--%2 Number Selection from Context Menu 1 is Top 2 is 2nd down etc.
If %0 <> 2
   Display ok Pass Security Sub 2 Variables
set %ITEM %1
set %Num_Dwn %2
Popup:
exevent popup %ITEM
Gosub Wait_for_Gump normal_gump 99_42 3
If #Result = #False
   Goto Popup
Gosub Click_offset 12 20
Gosub Wait_for_Gump generic_gump 220_180 3
If #Result <> #True
  goto Popup
set %Selection ( ( %Num_Dwn * 20 ) + 60 )
Gosub Click_offset 20 %Selection
Gosub Close_gump generic_gump 220_180
Return
;----------------------------------------
Sub Close_gump
; %1 = #contname of Gump to Close
; %2 = #contsize of Gump to Close
If %0 = 0
    Display ok Please pass %1 = #contsize & %2 = #contname to Close
IF #contsize = %2 && #contname = %1
  {
    set %X_offset 1
    set %Y_offset 1
    set %Click_X #contposX + %X_offset
    set %Click_Y #contposY + %Y_offset
    Click %Click_X %Click_Y r
}
Return
;----------------------------------------

[/code

Offline Khameleon

  • Script Tester - Team Leader
  • Elite
  • *
  • *
  • Posts: 2574
  • Activity:
    0%
  • Reputation Power: 30
  • Khameleon is a rising star!Khameleon is a rising star!Khameleon is a rising star!Khameleon is a rising star!Khameleon is a rising star!Khameleon is a rising star!
  • Gender: Male
  • Respect: +238
  • Referrals: 0
    • View Profile
Re: Rapid Use of exevent popup causes it to break?
« Reply #3 on: February 03, 2011, 04:53:17 PM »
0
oh.. I have a script that does that.. so I can verify that it cane be scripted ;)

Offline Kalaka

  • Full Member
  • ***
  • Posts: 215
  • Activity:
    0%
  • Reputation Power: 2
  • Kalaka has no influence.
  • Respect: +25
  • Referrals: 0
    • View Profile
Re: Rapid Use of exevent popup causes it to break?
« Reply #4 on: February 03, 2011, 08:25:45 PM »
0
Note: I'm not a good scripter..

What if you made popup a sub and just had it return to the beginning of a sub? Does that help?

Offline AlphaTopic starter

  • Hero Member
  • *
  • Posts: 583
  • Activity:
    0%
  • Reputation Power: 10
  • Alpha barely matters.Alpha barely matters.
  • Respect: +44
  • Referrals: 0
    • View Profile
Re: Rapid Use of exevent popup causes it to break?
« Reply #5 on: February 03, 2011, 10:18:27 PM »
0
Quote
oh.. I have a script that does that.. so I can verify that it cane be scripted

Ah well I have 1 too... I just didn't quite follow why I had to insert the wait 5 to get it to work.... The gump waits should be enough.  Ah well I'll play with the broken part by itself &  see if I can replicate the prob..

Tags: