ScriptUO

Official ScriptUO EasyUO Scripts => Scripting Chat => Topic started by: Cerveza on September 27, 2010, 07:31:47 AM

Title: onHotKey continue
Post by: Cerveza on September 27, 2010, 07:31:47 AM
Is this a good way to wait for a hotkey to continue?

Code: [Select]
set %waiting_to_start #TRUE
while %waiting_to_start = #TRUE
{
  onhotkey F10 alt
    set %waiting_to_start #FALSE
}

That would just cycle waiting for alt+F10 then continue? Should I put a "wait 1" in there?
Title: Re: onHotKey continue
Post by: Superslayer on September 27, 2010, 07:37:07 AM
That looks fine with me.  This is what I use with no wait and so far never a problem.

Code: [Select]
  set #targcurs 1
  while #true
  {
    repeat
      onhotkey %hotkey
        goto Island_End
    until #targcurs = 0
    break
  }
Title: Re: onHotKey continue
Post by: Paulonius on September 27, 2010, 08:08:05 AM
I just tried it with and without a wait 1 and it doesn't appear to affect CPU load either way.  Appears to be a pretty gentle loop. 
Title: Re: onHotKey continue
Post by: Cerveza on September 27, 2010, 08:11:36 AM
Wow, thanks Paul! Appreciate that.

I thought it was a slick little tidbit... should work well with a project I've been working on. I want the user to be able to load and run the script from anywhere to get the setup completed, then use a hotkey when they are in position to begin running the main script.
Title: Re: onHotKey continue
Post by: manwinc on September 27, 2010, 09:30:39 AM
That would work great with a looter
Title: Re: onHotKey continue
Post by: Cerveza on September 27, 2010, 09:40:11 AM
No doubt!

I never cared much for onhotkey. It always seems sluggish to me. But that's when it's used in a loop with other hotkey checks. I've even run a separate script to watch hotkeys and passed the info via globals to the main script.

This little thing just seems pretty slick. I think it'll work well with my application.

And, of course, anyone who can make use of this code is welcome to it.
Title: Re: onHotKey continue
Post by: Masscre on September 27, 2010, 10:51:26 AM
I miss the little black fart cloud that used to appear behind the little UO guys when they failed at casting a spell ?!
Title: Re: onHotKey continue
Post by: Cerveza on September 27, 2010, 10:57:43 AM
It's still there. Get the ID of that fart?
Title: Re: onHotKey continue
Post by: TrailMyx on September 27, 2010, 11:03:20 AM
I miss the little black fart cloud that used to appear behind the little UO guys when they failed at casting a spell ?!
Is that gone?  Wow, I guess I haven't played EA/OSI for a while.