ScriptUO

Official ScriptUO EasyUO Scripts => Scripting Chat => Topic started by: The Ghost on June 27, 2013, 08:25:32 PM

Title: System Variable
Post by: The Ghost on June 27, 2013, 08:25:32 PM
I have run into little problem because I uses the wrong variable sometime.   I'm trying to understand why.  I have read the tutorial and start cleaning and rebuild my old script.


1) finditem %itemA C_ , #BACKPACKID    ( this work every time)

2) finditem %itemA C_ , %BACKPACKID   ( this one to so good)

This work great for casting spell
Code: [Select]
checkHP:
if #hits < 120
{
    wait 20
    event macro 15 28 ; greather heal
    target 3s
    event macro 23 0
    goto checkPH
   }

this doesn't work
Code: [Select]
sub recallhome
    set %runebookID %book     ; book to recall home
    finditem %runebookID C_ , %backpackid
    set #ltargetID %runebookID
    set #ltargetkind 1
    wait 2s
    event macro 15 31  ; Recall Spell
    target 1s
    event macro 22 0  ; Last target
    wait 5s
Return


But if I do this, it work perfectly to recall of a book.   
Code: [Select]
sub recallhome
    set %runebookID %book     ; book to recall home
    finditem %runebookID C_ , %backpackid
    set #ltargetID %runebookID
    set #ltargetkind 1
    wait 2s
    event macro 15 31  ; Recall Spell
    wait 1s
    target
    event macro 22 0  ; Last target
    wait 5s
Return


So what the difference between those target wait.


and is this proper coding
Code: [Select]
sub unloadmainpack
repeat
finditem %leather C_ , #backpackid
    IF #findkind <> -1
       {
        exevent drag #findid #findstack
       exevent dropc %secure
        wait %lwait   ; 1s  wait
        }
     until #findkind = -1
Return

Thx
Title: Re: System Variable
Post by: TrailMyx on June 27, 2013, 08:44:10 PM
#BACKPACKID is a system variable setup from EasyUO, but %BACKPACKID is a user variable that YOU must initialize.  Why are you using #BACKPACKID?
Title: Re: System Variable
Post by: dxrom on June 27, 2013, 10:22:26 PM
Code: [Select]
sub recallhome
    set %runebookID %book     ; book to recall home
    finditem %runebookID C_ , %backpackid ;<<<<<
    set #ltargetID %runebookID ;<<<<<<
    set #ltargetkind 1
    wait 2s
    event macro 15 31  ; Recall Spell
    target 1s
    event macro 22 0  ; Last target
    wait 5s
Return

You are using finditem but not using the info it creates.

Code: [Select]
sub recallhome
    set %runebookID %book     ; book to recall home
    finditem %runebookID C_ , #backpackid
    set #ltargetID #findid
    set #ltargetkind 1
    wait 2s
    event macro 15 31  ; Recall Spell
    target 1s
    event macro 22 0  ; Last target
    wait 5s
Return

Try that instead.

Title: Re: System Variable
Post by: gimlet on June 28, 2013, 05:06:39 AM
target {timeout}

 Description

The target command waits for a target cursor to appear. If no timeout is given, the default timeout is 2 seconds.
Title: Re: System Variable
Post by: The Ghost on June 28, 2013, 05:54:34 AM
#BACKPACKID is a system variable setup from EasyUO, but %BACKPACKID is a user variable that YOU must initialize.  Why are you using #BACKPACKID?

Every time I  have to search my backpack  I use it. 
i.e. finditem HTD_UDF  C_ , #backpackid  ; Look for SOS