Official ScriptUO EasyUO Scripts > Scripting Chat

Check for enemies sub routine

(1/1)

Cerveza:
Does this seem right?

--- Code: ---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
--- End code ---

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?

TrailMyx:
Just a personal preference, just use "if #RESULT = #TRUE".  It's just more clear to the novice reader.

Cerveza:
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.

Navigation

[0] Message Index

Go to full version