ScriptUO

Official ScriptUO EasyUO Scripts => Scripting Chat => Topic started by: Cerveza on January 16, 2009, 05:43:22 AM

Title: Check for enemies sub routine
Post by: Cerveza on January 16, 2009, 05:43:22 AM
Does this seem right?
Code: [Select]
gosub check_for_enemies
if ! #result
  goto main_loop

sub check_for_enemy
  finditem #enemyid G
  if #findcnt > 0
  {
    gosub calc_next_location
    return #true
  }
return #false

The calc_next_location will set the next rune in the runebook to recall from. In the main_loop is the recall sub. So if a threat is detected it will force a recall to the next location.

Does the if ! #result look right? Or is that backwards?
Title: Re: Check for enemies sub routine
Post by: TrailMyx on January 16, 2009, 10:23:06 AM
Just a personal preference, just use "if #RESULT = #TRUE".  It's just more clear to the novice reader.
Title: Re: Check for enemies sub routine
Post by: Cerveza on January 16, 2009, 11:08:54 AM
Yeah, I like that better also. I'm rewriting some portions of an older script.

It's an old LJ script that works great for Library/Museum donations. It's a decent LJ script on it's own.

I'm adding an enemy detection sub, changing out the older subs that are out dated (like clickpos, gumpwait, journal stuff and recalling), and then I'll work on putting in a "dump then donate" so the char will dump tree stuff at a secure (home or bank) then go donate the boards.