Unknown2005-05-13 01:19:25
All the great bashers always tell you your bashing problems would be solved if you targeted the numbers and not the names. Really though, who the hell wants to type INFO HERE constantly, and type all those numbers? This script does it all for you, as well as highlight your target.
If you're not using my other scripts (particularly the logging.tf), you may need to make a few adjustments to this script. Without my other scripts you won't have the /echol macro. You might also want to make adjustments to some of the priority levels and -F options so they fit in better with what you're using in your system. As always, I'm posting my code to help you get ideas and design a system that fits your own needs.
How to use it:
The script tracks your target's name and number in two separate variables; target and targetnumber. The user interface to the system is the alias "t", which has three different ways you can use it:
This command will set your target's name to, then run INFO HERE (all gagged so you don't have to see it) and collect the first available number of an object named in the room. If there is no in your room, the targetnumber will just be empty. Both values are reported to you after typing this command.
This command will attempt to get another number associated with a target in the room. The INFO HERE list is random for the most part, so you may get the same number if your target is still in the room, you might not. It's intended for use if when you set your target there wasn't one in the room (thus the targetnumber variable would be blank). It reports to you the number it found, if any.
This command clears both target variables, and deletes all highlighting and other triggers associated with the targets.
How does my system know whether to use the target or target number for attacks?
I wrote a macro that can be used in either command or function form. Normally when you make an attack you might do something like this in your script:
In place of that variable reference, you'll want to insert my macro/function like so:
The target function will insert the targetnumber if it exists, if not it will insert the target's name.
When you target something a trigger is also created for the "You have slain" line. When you kill something you have targeted, the trigger will attempt to get another number associated with another target in the room.
So basically, once you target an NPC and start attacking a room full of them, you won't have to do any targeting the rest of the time and you'll always be targeting by the numbers (unless your targeted NPC leaves the room).
Here's the code, enjoy!
If you're not using my other scripts (particularly the logging.tf), you may need to make a few adjustments to this script. Without my other scripts you won't have the /echol macro. You might also want to make adjustments to some of the priority levels and -F options so they fit in better with what you're using in your system. As always, I'm posting my code to help you get ideas and design a system that fits your own needs.
How to use it:
The script tracks your target's name and number in two separate variables; target and targetnumber. The user interface to the system is the alias "t", which has three different ways you can use it:
QUOTE
t
This command will set your target's name to
QUOTE
t
This command will attempt to get another number associated with a target in the room. The INFO HERE list is random for the most part, so you may get the same number if your target is still in the room, you might not. It's intended for use if when you set your target there wasn't one in the room (thus the targetnumber variable would be blank). It reports to you the number it found, if any.
QUOTE
t none
This command clears both target variables, and deletes all highlighting and other triggers associated with the targets.
How does my system know whether to use the target or target number for attacks?
I wrote a macro that can be used in either command or function form. Normally when you make an attack you might do something like this in your script:
CODE
/alias kill punch %{target}
In place of that variable reference, you'll want to insert my macro/function like so:
CODE
/alias kill punch $
The target function will insert the targetnumber if it exists, if not it will insert the target's name.
When you target something a trigger is also created for the "You have slain" line. When you kill something you have targeted, the trigger will attempt to get another number associated with another target in the room.
So basically, once you target an NPC and start attacking a room full of them, you won't have to do any targeting the rest of the time and you'll always be targeting by the numbers (unless your targeted NPC leaves the room).
Here's the code, enjoy!
CODE
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;               targeting               ;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
/set target=
/set targetnumber=
;;; obtain the targeting value to use (either the name or the number)
;;; syntax: target() or /target
/def target = \\
  /if ({targetnumber} !~ "") \\
    /result {targetnumber} %; \\
  /else \\
    /result {target} %; \\
  /endif
;;; obtain first available object number associated with the current target using INFO HERE
;;; syntax: /targeting_get_number
/def targeting_get_number = \\
  /set targetnumber= %; \\
  /def -mregexp -n1 -p150 -ag -t'^".*\\\\b%{target}(\\\\d+)"' targeting_info_here_catch_target = \\
    /set targetnumber=%%{P1} %; \\
  /def -mregexp -n0 -p149 -ag -t".*" targeting_info_here_catch_all %; \\
  /def -mregexp -n1 -p151 -ag -t"^Number of objects: \\\\d+" targeting_info_here_end = \\
    /undef targeting_info_here_catch_all %%; \\
    /if ({targetnumber} =~ "") \\
      /undef targeting_info_here_catch_target %%; \\
    /endif %%; \\
    /echol BCcyan 0 <<<< target # = %%{targetnumber} >>>> %; \\
  /send info here
;;; set/unset your target
;;; syntax: t
/alias t \\
  /if ({#} > 0) \\
    /if ({target} !~ "") \\
      /undef targeting_highlight %; \\
      /undef targeting_slain %; \\
    /endif %; \\
    /set target= %; \\
    /set targetnumber= %; \\
    /if ({1} !~ "none") \\
      /set target=%{1} %; \\
      /def -mregexp -n0 -p210 -F -P1xBCgreen -t"(%{1})" targeting_highlight %; \\
      /def -mregexp -n0 -p148 -F -P1BCcyan -t"^(You have slain) .*%{target}.*\\." targeting_slain = \\
        /targeting_get_number %; \\
      /echol BCcyan 0 <<<< target = %{target} >>>> %; \\
      /targeting_get_number %; \\
    /else \\
      /echol BCcyan 0 <<<< target unset >>>> %; \\
    /endif %; \\
  /else \\
    /if ({target} !~ "") \\
      /echol BCcyan 0 <<<< target = %{target} >>>> %; \\
      /targeting_get_number %; \\
    /else \\
      /echol BCcyan 0 <<<< you do not have a target >>>> %; \\
    /endif %; \\
  /endif
;;;;;;               targeting               ;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
/set target=
/set targetnumber=
;;; obtain the targeting value to use (either the name or the number)
;;; syntax: target() or /target
/def target = \\
  /if ({targetnumber} !~ "") \\
    /result {targetnumber} %; \\
  /else \\
    /result {target} %; \\
  /endif
;;; obtain first available object number associated with the current target using INFO HERE
;;; syntax: /targeting_get_number
/def targeting_get_number = \\
  /set targetnumber= %; \\
  /def -mregexp -n1 -p150 -ag -t'^".*\\\\b%{target}(\\\\d+)"' targeting_info_here_catch_target = \\
    /set targetnumber=%%{P1} %; \\
  /def -mregexp -n0 -p149 -ag -t".*" targeting_info_here_catch_all %; \\
  /def -mregexp -n1 -p151 -ag -t"^Number of objects: \\\\d+" targeting_info_here_end = \\
    /undef targeting_info_here_catch_all %%; \\
    /if ({targetnumber} =~ "") \\
      /undef targeting_info_here_catch_target %%; \\
    /endif %%; \\
    /echol BCcyan 0 <<<< target # = %%{targetnumber} >>>> %; \\
  /send info here
;;; set/unset your target
;;; syntax: t
/alias t \\
  /if ({#} > 0) \\
    /if ({target} !~ "") \\
      /undef targeting_highlight %; \\
      /undef targeting_slain %; \\
    /endif %; \\
    /set target= %; \\
    /set targetnumber= %; \\
    /if ({1} !~ "none") \\
      /set target=%{1} %; \\
      /def -mregexp -n0 -p210 -F -P1xBCgreen -t"(%{1})" targeting_highlight %; \\
      /def -mregexp -n0 -p148 -F -P1BCcyan -t"^(You have slain) .*%{target}.*\\." targeting_slain = \\
        /targeting_get_number %; \\
      /echol BCcyan 0 <<<< target = %{target} >>>> %; \\
      /targeting_get_number %; \\
    /else \\
      /echol BCcyan 0 <<<< target unset >>>> %; \\
    /endif %; \\
  /else \\
    /if ({target} !~ "") \\
      /echol BCcyan 0 <<<< target = %{target} >>>> %; \\
      /targeting_get_number %; \\
    /else \\
      /echol BCcyan 0 <<<< you do not have a target >>>> %; \\
    /endif %; \\
  /endif
Unknown2005-05-13 02:22:05
I've got quite a few of your scripts to try Druth. I'm starting to get overwhelmed...
Thanks again for the awesome contribution. I should be looking forward to tinkering with this!
Thanks again for the awesome contribution. I should be looking forward to tinkering with this!
Unknown2005-05-13 03:12:02
QUOTE(Neocount @ May 12 2005, 09:22 PM)
I've got quite a few of your scripts to try Druth. I'm starting to get overwhelmed...
Thanks again for the awesome contribution. I should be looking forward to tinkering with this!
Thanks again for the awesome contribution. I should be looking forward to tinkering with this!
117092
I'm glad you're finding uses for and enjoying my scripts! It's always nice to get positive feedback.
Thanks!