Unknown2005-10-19 00:39:22
I worked a bit on my tracking script, getting it up to par and integrated into my newish system (everythings at my homepage, as usual). For those that don't remember, this script manages the highlighting of other players and locating them with THIRDEYE.
One nifty point of interest is the /define_dynamic_stacks macro which simultaneously parses CW, GW, COMMUNEENEMIES, and GUILD ENEMIES behind the scenes. I used to have those as separate commands, now they're all combined in one that's more efficient and less buggy. I wrote regexps to grab specific lines as well (no longer relying on ".*" catch-all statements) which means it doesn't grab and gag any lines it's not supposed to.
/define_dynamic_stacks code snippet:
I added a few lines to my script_management.tf file that cause this macro to be run every 5 minutes. Works great thus far, havn't really noticed anything going wrong.
script_management.tf code snippet:
I also made some changes to my three locating macros (things that parse WHO via THIRDEYE) to make them less buggy and more reliable. Thus far they're working great. One locates a specific player, another locates all players at a specific location, and the last locates all players at a specific person's location. I have aliases that make it easy to use the stacks/lists of players that the first half of the script uses (so it's trivial to locate all enemies, allies, suppliers, etc).
I'm not going to paste the whole thing here, screw posterity. Here's direct linkage to a syntax highlighted version of the script: http://bwbettin.com/pages/programming/tf-html/tracking.html
One nifty point of interest is the /define_dynamic_stacks macro which simultaneously parses CW, GW, COMMUNEENEMIES, and GUILD ENEMIES behind the scenes. I used to have those as separate commands, now they're all combined in one that's more efficient and less buggy. I wrote regexps to grab specific lines as well (no longer relying on ".*" catch-all statements) which means it doesn't grab and gag any lines it's not supposed to.
/define_dynamic_stacks code snippet:
CODE
;###################################################################;
;#####  automaticly define dynamic player highlighting stacks  #####;
;###################################################################;
;### define citymate, guildmate, cityenemy, and guildenemy highlights based on CW, GW, COMMUNEENEMIES, and GUILD ENEMIES (silent, intended for use with /repeat)
;### syntax: /define_dynamic_stacks
/def define_dynamic_stacks = \\
; Â # clear the old highlighting stacks
  /player_highlight_remove 1 citymate %{stack_citymate} %; \\
  /player_highlight_remove 1 guildmate %{stack_guildmate} %; \\
  /player_highlight_remove 1 unofficial_enemy %{stack_unofficial_enemy} %; \\
; Â # define the citymate stack based on CW
  /def -n1 -p50 -agL -t"^(\\\\*)+\\\\(\\\\*)+\\$" tracking_define_citymates_start = \\
    /def -n1 -p51 -agL -t"^Commune Member    Rank         Position          CT  \\\\\\$" tracking_define_citymates_erroneous_line1 %%; \\
    /def -n1 -p51 -agL -t"^-------------------------------------------------------------------------------\\\\\\$" tracking_define_citymates_erroneous_line2 %%; \\
    /def -n1 -p51 -agL -t"^(\\\\\\\\*)+\\\\\\$" tracking_define_citymates_erroneous_line3 %%; \\
    /def -n1 -p51 -agL -t"^Kharnach" tracking_define_citymates_erroneous_line4 %%; \\
    /def -n0 -p50 -agL -t"^(\\\\\\\\w+) " tracking_define_citymates_catch_members = \\
      /let current_citymate=$$$ %%%; \\
      /player_highlight_add 1 citymate 140 Cmagenta %%%{current_citymate} %%; \\
    /def -n1 -p51 -agL -t"^Total Commune Members: \\\\\\\\d+" tracking_define_citymates_done = \\
      /undef tracking_define_citymates_catch_members %; \\
; Â # define the guildmate stack based on GW
  /def -n1 -p50 -agL -t"^(\\\\*)+\\\\(\\\\*)+\\$" tracking_define_guildmates_start = \\
    /def -n1 -p51 -agL -t"^Guildmember      Rank   Position             GT   GNT  \\\\\\$" tracking_define_guildmates_erroneous_line1 %%; \\
    /def -n1 -p51 -agL -t"^-------------------------------------------------------------------------------\\\\\\$" tracking_define_guildmates_erroneous_line2 %%; \\
    /def -n1 -p51 -agL -t"^(\\\\\\\\*)+\\\\\\$" tracking_define_guildmates_erroneous_line3 %%; \\
    /def -n1 -p51 -agL -t"^Kharnach" tracking_define_guildmates_erroneous_line4 %%; \\
    /def -n0 -p50 -agL -t"^(\\\\\\\\w+) " tracking_define_guildmates_catch_members = \\
      /let current_guildmate=$$$ %%%; \\
      /player_highlight_add 1 guildmate 130 Ccyan %%%{current_guildmate} %%; \\
    /def -n1 -p51 -agL -t"^Total Guildmembers: \\\\\\\\d+" tracking_define_guildmates_done = \\
      /undef tracking_define_guildmates_catch_members %; \\
; Â # define the unofficial_enemy stack based on COMMUNEENEMIES
  /def -n1 -p50 -agL -t"^Enemies of the Forest of Glomdoring:\\$" tracking_define_cityenemies_start = \\
    /def -n0 -p50 -agL -t".*" tracking_define_cityenemies_catch_all = \\
      /let current_cityenemy_row=$$$ %%%; \\
      /let current_cityenemy_row=$$$ %%%; \\
      /player_highlight_add 1 unofficial_enemy 180 Cred %%%{current_cityenemy_row} %%; \\
    /def -n1 -p51 -agL -t"^Total: \\\\\\\\d+" tracking_define_cityenemies_done = \\
      /undef tracking_define_cityenemies_catch_all %; \\
; Â # append guild enemies to the unofficial_enemy stack based on GUILD ENEMIES
  /def -n1 -p50 -agL -t"^Enemies of the Ebonguard Guild:\\$" tracking_define_guildenemies_start = \\
    /def -n0 -p50 -agL -t".*" tracking_define_guildenemies_catch_all = \\
      /let current_guildenemy_row=$$$ %%%; \\
      /let current_guildenemy_row=$$$ %%%; \\
      /player_highlight_add 1 unofficial_enemy 180 Cred %%%{current_guildenemy_row} %%; \\
    /def -n1 -p51 -agL -t"^Total: \\\\\\\\d+" tracking_define_guildenemies_done = \\
      /undef tracking_define_guildenemies_catch_all %; \\
; Â # gag the temporary alteration to your pagelength
  /def -n1 -p50 -agL -t"^Your current pagelength: 250\\$" tracking_define_dynamic_pagelength_250 %; \\
  /def -n1 -p50 -agL -t"^Your current pagelength: 25\\$" tracking_define_dynamic_pagelength_25 %; \\
  /send config pagelength 250 %; \\
  /send cw %; \\
  /send gw %; \\
  /send communeenemies %; \\
  /send guild enemies %; \\
  /send config pagelength 25
;#####  automaticly define dynamic player highlighting stacks  #####;
;###################################################################;
;### define citymate, guildmate, cityenemy, and guildenemy highlights based on CW, GW, COMMUNEENEMIES, and GUILD ENEMIES (silent, intended for use with /repeat)
;### syntax: /define_dynamic_stacks
/def define_dynamic_stacks = \\
; Â # clear the old highlighting stacks
  /player_highlight_remove 1 citymate %{stack_citymate} %; \\
  /player_highlight_remove 1 guildmate %{stack_guildmate} %; \\
  /player_highlight_remove 1 unofficial_enemy %{stack_unofficial_enemy} %; \\
; Â # define the citymate stack based on CW
  /def -n1 -p50 -agL -t"^(\\\\*)+\\\\(\\\\*)+\\$" tracking_define_citymates_start = \\
    /def -n1 -p51 -agL -t"^Commune Member    Rank         Position          CT  \\\\\\$" tracking_define_citymates_erroneous_line1 %%; \\
    /def -n1 -p51 -agL -t"^-------------------------------------------------------------------------------\\\\\\$" tracking_define_citymates_erroneous_line2 %%; \\
    /def -n1 -p51 -agL -t"^(\\\\\\\\*)+\\\\\\$" tracking_define_citymates_erroneous_line3 %%; \\
    /def -n1 -p51 -agL -t"^Kharnach" tracking_define_citymates_erroneous_line4 %%; \\
    /def -n0 -p50 -agL -t"^(\\\\\\\\w+) " tracking_define_citymates_catch_members = \\
      /let current_citymate=$$$ %%%; \\
      /player_highlight_add 1 citymate 140 Cmagenta %%%{current_citymate} %%; \\
    /def -n1 -p51 -agL -t"^Total Commune Members: \\\\\\\\d+" tracking_define_citymates_done = \\
      /undef tracking_define_citymates_catch_members %; \\
; Â # define the guildmate stack based on GW
  /def -n1 -p50 -agL -t"^(\\\\*)+\\\\(\\\\*)+\\$" tracking_define_guildmates_start = \\
    /def -n1 -p51 -agL -t"^Guildmember      Rank   Position             GT   GNT  \\\\\\$" tracking_define_guildmates_erroneous_line1 %%; \\
    /def -n1 -p51 -agL -t"^-------------------------------------------------------------------------------\\\\\\$" tracking_define_guildmates_erroneous_line2 %%; \\
    /def -n1 -p51 -agL -t"^(\\\\\\\\*)+\\\\\\$" tracking_define_guildmates_erroneous_line3 %%; \\
    /def -n1 -p51 -agL -t"^Kharnach" tracking_define_guildmates_erroneous_line4 %%; \\
    /def -n0 -p50 -agL -t"^(\\\\\\\\w+) " tracking_define_guildmates_catch_members = \\
      /let current_guildmate=$$$ %%%; \\
      /player_highlight_add 1 guildmate 130 Ccyan %%%{current_guildmate} %%; \\
    /def -n1 -p51 -agL -t"^Total Guildmembers: \\\\\\\\d+" tracking_define_guildmates_done = \\
      /undef tracking_define_guildmates_catch_members %; \\
; Â # define the unofficial_enemy stack based on COMMUNEENEMIES
  /def -n1 -p50 -agL -t"^Enemies of the Forest of Glomdoring:\\$" tracking_define_cityenemies_start = \\
    /def -n0 -p50 -agL -t".*" tracking_define_cityenemies_catch_all = \\
      /let current_cityenemy_row=$$$ %%%; \\
      /let current_cityenemy_row=$$$ %%%; \\
      /player_highlight_add 1 unofficial_enemy 180 Cred %%%{current_cityenemy_row} %%; \\
    /def -n1 -p51 -agL -t"^Total: \\\\\\\\d+" tracking_define_cityenemies_done = \\
      /undef tracking_define_cityenemies_catch_all %; \\
; Â # append guild enemies to the unofficial_enemy stack based on GUILD ENEMIES
  /def -n1 -p50 -agL -t"^Enemies of the Ebonguard Guild:\\$" tracking_define_guildenemies_start = \\
    /def -n0 -p50 -agL -t".*" tracking_define_guildenemies_catch_all = \\
      /let current_guildenemy_row=$$$ %%%; \\
      /let current_guildenemy_row=$$$ %%%; \\
      /player_highlight_add 1 unofficial_enemy 180 Cred %%%{current_guildenemy_row} %%; \\
    /def -n1 -p51 -agL -t"^Total: \\\\\\\\d+" tracking_define_guildenemies_done = \\
      /undef tracking_define_guildenemies_catch_all %; \\
; Â # gag the temporary alteration to your pagelength
  /def -n1 -p50 -agL -t"^Your current pagelength: 250\\$" tracking_define_dynamic_pagelength_250 %; \\
  /def -n1 -p50 -agL -t"^Your current pagelength: 25\\$" tracking_define_dynamic_pagelength_25 %; \\
  /send config pagelength 250 %; \\
  /send cw %; \\
  /send gw %; \\
  /send communeenemies %; \\
  /send guild enemies %; \\
  /send config pagelength 25
I added a few lines to my script_management.tf file that cause this macro to be run every 5 minutes. Works great thus far, havn't really noticed anything going wrong.
script_management.tf code snippet:
CODE
    /kill %{sm_define_dynamic_stacks_pid} %; \\
    /test sm_define_dynamic_stacks_pid:=repeat('-0:5:0 i /define_dynamic_stacks') %; \\
    /test sm_define_dynamic_stacks_pid:=repeat('-0:5:0 i /define_dynamic_stacks') %; \\
I also made some changes to my three locating macros (things that parse WHO via THIRDEYE) to make them less buggy and more reliable. Thus far they're working great. One locates a specific player, another locates all players at a specific location, and the last locates all players at a specific person's location. I have aliases that make it easy to use the stacks/lists of players that the first half of the script uses (so it's trivial to locate all enemies, allies, suppliers, etc).
I'm not going to paste the whole thing here, screw posterity. Here's direct linkage to a syntax highlighted version of the script: http://bwbettin.com/pages/programming/tf-html/tracking.html
Unknown2005-10-19 01:03:54
I actually had a question regarding the locating macros. Your old version has a bug when you try to locate all players at a specific location - if the location has an apostrophe in the its name (ie Midnight's Gate), only one person is listed. This was also the case when there was a parenthesis in the location's name. I was wondering if this bug was fixed in your new release or not. As always, top notch work bwbettin. Thanks for sharing.