Author Topic: Exiting a button within a loop  (Read 1941 times)

0 Members and 1 Guest are viewing this topic.

Offline The GhostTopic starter

  • Elite
  • *
  • *
  • Posts: 1917
  • Activity:
    0%
  • Reputation Power: 25
  • The Ghost is on the verge of being accepted.The Ghost is on the verge of being accepted.The Ghost is on the verge of being accepted.The Ghost is on the verge of being accepted.The Ghost is on the verge of being accepted.
  • Respect: +245
  • Referrals: 0
    • View Profile
Exiting a button within a loop
« on: January 09, 2015, 09:59:36 PM »
0
Been hunting some little monster and I'm tired to hitting play/stop from window every time.  So I decide to make a menu,  I find out that I can perform one action at the time. Heal my self, recall, invis.   Now I'm trying to attack a monster with spell  and keep casting until dead.

I try this but it doesn't exit after the monster is dead.  What do I'm missing
Code: [Select]
gosub menu1

set #menuButton N/A
set %EndScript #false
Repeat
  If #MenuButton <> N/A
     {
     gosub #menuButton
     set #menuButton N/A
     }
until #menubutton = closed

Sub button1 ;  kill monster
 repeat
finditem xxx G_10
if #findcnt > 0
{
  set #ltargetkind 1
  set #ltargetid #findid
  event macro 15 17   
  target 3s
  event macro 22
  wait 2s
}
set #RESULT #FALSE
until #FALSE
event macro 3 0  Return_out
return #RESULT


Offline The GhostTopic starter

  • Elite
  • *
  • *
  • Posts: 1917
  • Activity:
    0%
  • Reputation Power: 25
  • The Ghost is on the verge of being accepted.The Ghost is on the verge of being accepted.The Ghost is on the verge of being accepted.The Ghost is on the verge of being accepted.The Ghost is on the verge of being accepted.
  • Respect: +245
  • Referrals: 0
    • View Profile
Re: Exiting a button within a loop
« Reply #1 on: January 10, 2015, 05:21:50 PM »
0
After doing a bit of testing, I was able to get it to work this way.  Not sure if this is the best way but it seen to work.

Code: [Select]
Sub button1
 repeat
finditem XXX G_10
if #findkind = -1
   return
if #findcnt > 0
{
  set #ltargetkind 1
  set #ltargetid #findid
  event macro 15 17
  target 3s
  event macro 22
  wait 2s
}
; until #CLICNT = 0
until #false

Tags: