ScriptUO

Official ScriptUO EasyUO Scripts => Script Library => Misc. Scripts => Topic started by: Cerveza on August 08, 2011, 05:08:08 PM

Title: Cerv's Tracking List
Post by: Cerveza on August 08, 2011, 05:08:08 PM
Code: [Select]
;=========================================
; Script Name: Cerv's Tracking List
; Author: Cerveza
; Version: No version.
; Shard OSI / FS: ONLY tested OSI
; Revision Date: 08 Aug 2011
; Public Release: v1.0
;=========================================
; Purpose:
;   Keep a listing of tracked players
; Requirements:
;   Tracking skill would be nice
;   KalOCR must be in default directory
;=========================================;
;    ____         _      _  __   _____    ;
;   / __/ ___ _ _(_)_ __| |_\ \ / / _ \   ;
;   \__ \/  _| `_| | ` \   _/ / \ \/ \ \  ;
;   __/  \ (_| | | | |) | | \ \_/ /\_/ /  ;
;   \____/\__|_| |_|  _/|_|  \___/\___/   ;
;                  |_|ScriptUO.com        ;
;=========================================;

Will list players found using the tracking skill.

I need a little help with this one. The script works great as is, but I'd really like to include newly found people on the top of the list instead of having them added to the bottom. When added to the bottom you always have to pull down the side thing to see the latest. I'd really like the newest to be visible on the top of the list.

I know someone out there knows how to do this... please pass the info along, it would really make this a slick tool.
Title: Re: Cerv's Tracking List
Post by: Neo on August 09, 2011, 10:04:58 AM
Hi Cerveza, first of all, great script...

I was thinking about what you said of adding the names on top of the list, and this is what I came up with:

Code: [Select]
set #lpc 4000
set %listcnt 1  ;listcnt is what's going to keep track of created "lists"
gosub showmenu

repeat
gosub doit
wait 3s ; 7 second timout in gumpwait
until #false

sub doit
event macro 13 38 ; use skill tracking
gosub TM_GumpWait generic_gump
gosub offsetclick 337 123 l
gosub TM_GumpWait generic_gump
if #result = #FALSE
  return
call kalocr.txt getTrackingInfo #contposX #contposY #contsize
for %i 1 !tgi_cnt
  {
  set %name !tgi_name . %i ; note the "dot"
  set %list . %listcnt %name
  set %listcnt %listcnt + 1 ; lists will be named %list1, %list2 , ... , %listn
  }
menu delete list
menu List Create list 0 0 199 353
for %n %listcnt 1 ; so the previous list will be deleted, and a new one will be created
  {               ; in this order: %listn, %listn-1 , ... , %list1
  if %list . %n <> N/A ;a safety check to avoid N/A's in your list
  menu list add list %list . %n ;lists every list backwards
  }
gosub offsetclick 1 1 r
wait 7s
return

;-------------------------------------------------------------------------------
sub OffsetClick
  set %tempx %1 + #CONTPOSX
  set %tempy %2 + #CONTPOSY
  click %tempx %tempy %3
return

;-------------------------------------------------------------------------------
; %1 = Gumpname 1
; %2 = Gumpname 2
; #TRUE gump occured before timeout
sub TM_GumpWait
  namespace push
  namespace local GW
  wait 10
  set !timedelay #SCNT
  while #SCNT <= !timedelay + 7
  {
    if #CONTNAME = %1 || #CONTNAME = %2
    {
      namespace pop
      return #TRUE
    }
  }
  namespace pop
return #FALSE

sub showmenu
menu Clear
menu Window Title Cerv's Tracker List
menu Window Color BtnFace
menu Window Size 200 387
menu Font Transparent #true
menu Font Align Right
menu Font Name MS Sans Serif
menu Font Size 8
menu Font Style
menu Font Color WindowText
menu Font Align Left
menu Font Name Courier New
menu Font Size 10
menu Font Color Black
menu Font BGColor Window
menu List Create list 0 0 199 353
menu Show 421 270
return
I've added comments on the lines I changed... Hope this is what you meant, and if it is, hope you find this useful! :)

Cheers!

EDIT: found a minor issue, should be fixed now
Title: Re: Cerv's Tracking List
Post by: Cerveza on August 09, 2011, 10:17:36 AM
Cool, I'll play with it some tonight. Appreciate the help with that.
Title: Re: Cerv's Tracking List
Post by: Cerveza on August 16, 2011, 04:43:54 PM
Working awesome!

Now, let's get the time for each "hit" ?
Title: Re: Cerv's Tracking List
Post by: Neo on August 16, 2011, 04:53:13 PM
Working awesome!

Now, let's get the time for each "hit" ?
That would be nice!

I was also thinking that it would be cool to add a way to not repeat names...

For instance, if you tracked PlayerA, PlayerB, PlayerC the first time around... Next time you track you get PlayerB, PlayerC and PlayerD... It would then delete PlayerB and PlayerC from the back of the list and add them on top, together with PlayerD... And leave just PlayerA back there... That way, you would get the last tracked time for each player, without all those repeated names in the list...
Title: Re: Cerv's Tracking List
Post by: Cerveza on August 16, 2011, 05:12:34 PM
Ahhh, nice thinking!
Title: Re: Cerv's Tracking List
Post by: Neo on August 16, 2011, 09:44:17 PM
I think I came up with something Cerveza. Check it out:
Code: [Select]
;=========================================
; Script Name: Cerv's Tracking List
; Author: Cerveza
; Version: No version.
; Shard OSI / FS: ONLY tested OSI
; Revision Date: 08 Aug 2011
; Public Release: v1.0
;=========================================
; Purpose:
;   Keep a listing of tracked players
; Requirements:
;   Tracking skill would be nice
;=========================================;
;    ____         _      _  __   _____    ;
;   / __/ ___ _ _(_)_ __| |_\ \ / / _ \   ;
;   \__ \/  _| `_| | ` \   _/ / \ \/ \ \  ;
;   __/  \ (_| | | | |) | | \ \_/ /\_/ /  ;
;   \____/\__|_| |_|  _/|_|  \___/\___/   ;
;                  |_|ScriptUO.com        ;
;=========================================;
set #lpc 4000
set %namecnt 0
gosub showmenu

repeat
gosub doit
wait 3s ; 7 second timout in gumpwait
until #false

sub doit
event macro 13 38 ; use skill tracking
gosub TM_GumpWait generic_gump
gosub offsetclick 337 123 l
gosub TM_GumpWait generic_gump
if #result = #FALSE
  return
call kalocr.txt getTrackingInfo #contposX #contposY #contsize
set %oldnamecnt %namecnt
for %i 1 !tgi_cnt
    {
    set %namecnt %namecnt + 1
    set %name . %namecnt !tgi_name . %i
    gosub gettime
    set %ctime . %namecnt #result
    }
set %oldnamecnt1 %oldnamecnt + 1
for %n %oldnamecnt1 %namecnt
    {
    for %o 0 %oldnamecnt
        {
        if %name . %o = %name . %n
           {
           set %name . %o N/A
           }
        }
    }
menu delete list
menu List Create list 0 0 224 353
for %p %namecnt 1
    {
    if %name . %p <> N/A
       {
       menu list add list %name . %p , #spc , @ , #spc , %ctime . %p
       }
    }
gosub offsetclick 1 1 r
wait 7s
return

;-------------------------------------------------------------------------------
sub gettime
namespace push
namespace local ct
set !string #time
str left !string 2
set !h #strRes
str Mid !string 3 2
set !m #strRes
str Right !string 2
set !s #strRes
if !h < 12
   {
   set %meridiem AM
   }
if !h >= 12
   {
   set %meridiem PM
   if !h >= 13
      {
      set !h !h - 12
      }
   }
set !hour !h , :
set !min !m , :
set !sec !s
set !ctime !hour , !min , !sec , #spc , %meridiem
set #result !ctime
namespace pop
return #result
;-------------------------------------------------------------------------------
sub OffsetClick
  set %tempx %1 + #CONTPOSX
  set %tempy %2 + #CONTPOSY
  click %tempx %tempy %3
return

;-------------------------------------------------------------------------------
; %1 = Gumpname 1
; %2 = Gumpname 2
; #TRUE gump occured before timeout
sub TM_GumpWait
  namespace push
  namespace local GW
  wait 10
  set !timedelay #SCNT
  while #SCNT <= !timedelay + 7
  {
    if #CONTNAME = %1 || #CONTNAME = %2
    {
      namespace pop
      return #TRUE
    }
  }
  namespace pop
return #FALSE

sub showmenu
menu Clear
menu Window Title Cerv's Tracker List
menu Window Color BtnFace
menu Window Size 225 387
menu Font Transparent #true
menu Font Align Right
menu Font Name MS Sans Serif
menu Font Size 8
menu Font Style
menu Font Color WindowText
menu Font Align Left
menu Font Name Courier New
menu Font Size 10
menu Font Color Black
menu Font BGColor Window
menu List Create list 0 0 224 353
menu Show 421 270
return
I had to change the structure a little bit, but it seems to be working nicely...

EDIT: Seconds timer had a typo, seems perfect now! :)
Title: Re: Cerv's Tracking List
Post by: NObama on August 16, 2011, 10:07:14 PM
You're going to use his to auto-page on people who page on you, i just know it!

Title: Re: Cerv's Tracking List
Post by: MeWonUo on August 16, 2011, 10:18:08 PM
You're going to use his to auto-page on people who page on you, i just know it!



 ;D  Now that would be absolutely hilarious!
Title: Re: Cerv's Tracking List
Post by: Neo on August 16, 2011, 10:20:48 PM
You're going to use his to auto-page on people who page on you, i just know it!


lol that would be awesome!
Title: Re: Cerv's Tracking List
Post by: Cerveza on August 21, 2011, 11:20:16 AM
Ok, finally got a chance to try this, working really slick. This is how I envisioned this script working! Great job frneo!