|
irmalaki Newbie
Joined: 10 Sep 2007 Posts: 7
|
Posted: Mon Sep 10, 2007 6:58 am
Highlight List / Friend List / PK List |
I have searched around the help, and forums and havnt found anything specific to this yet. Saw one mention vaugly of a friendslist. So here it goes.
I am trying to make a list that stores names, and then set up a trigger or something to highlight everything in that list a certain color.
To a greater extent also trying to create triggers to trigger on those in the list.
I have setup a class folder called Triggers then under that i have PK.
/Triggers/
Name Type Value
pkon Alias #T+ PK
pkoff Alias #T- PK
PK Class
/Triggers/PK/
Name Type Value
pkadd Alias #ADDITEM pklist%1
pkremove Alias #DELITEM pklist %1
pklist Alias #SHOW %sort(@pklist)
pklist Var name1|name2|name3
It works as far as turning it on and off, I wanted that feature more for when i figure out how to setup pk triggers on the list etc.
I can add people, remove people, and list it just fine.
I just cant figure out a trigger or a way to highlight / trigger on the people in the list.
If anyone has any ideas or has done this already please let me know. Im open for criticism and ideas.
I use Zmud 7.21 |
|
|
|
Fang Xianfu GURU
Joined: 26 Jan 2004 Posts: 5155 Location: United Kingdom
|
Posted: Mon Sep 10, 2007 11:41 am |
#trig {%q{@pklist}%q} {#color red}
{@pklist} will be expanded into {name1|name2|name3}, which is the syntax for more than one possible pattern (so any of the names on the list will match). %q matches a zero-width word boundary - a gap between something that's a word and something that's not a word. That makes it so that if "Jo" is on your list, it won't highlight the first two characters of "Joe".
%q is the equivalent of the regex \b. More info on \b is available here. |
|
|
|
irmalaki Newbie
Joined: 10 Sep 2007 Posts: 7
|
Posted: Mon Sep 10, 2007 4:53 pm |
Thats what i was missing, thanks so much it works now and i can do so much more. WEEE!
ps. You Rule.kthx. |
|
|
|
irmalaki Newbie
Joined: 10 Sep 2007 Posts: 7
|
Posted: Thu Sep 13, 2007 6:31 am |
Ok , i have setup some more triggers and things and got the different lists working nicley now. Here is a 2nd part to this i am having issue on syntax im sure.
Building ontop of previous posts all information being the same.
Game Output:
Joe flies in from the east.
Ed flies in from the north.
What would be the best way of testing if first Joe is on the pklist, and if it is on the list to perform a action like c 'harm' Joe.
Basically testing anyone that flies in or whatever game output i set it up to be.
My attempts get everything working except proper trigger commands i get it as far as to c 'Harm' , but no target when triggering off people on the list.
Any ideas or references would be appreciated.
Thanks. |
|
|
|
Fang Xianfu GURU
Joined: 26 Jan 2004 Posts: 5155 Location: United Kingdom
|
Posted: Thu Sep 13, 2007 11:50 am |
#trig {(%w) flies in from the %w.} {#if %ismember(%1,@pklist) {c 'Harm %1}}
However! I don't advise using this often - you could end up attacking people who you've forgotten to remove from the list, or in a no-pk area. Make an alias to enable and disable this trigger, and keep it off except for when you really need it. |
|
|
|
gamma_ray Magician
Joined: 17 Apr 2005 Posts: 496
|
Posted: Thu Sep 13, 2007 1:09 pm |
#trig {({@pklist}) flies in from the %w.} {c 'harm %1'}
|
|
|
|
irmalaki Newbie
Joined: 10 Sep 2007 Posts: 7
|
Posted: Mon Oct 01, 2007 2:52 am |
I tried Fang Xianfu 's solution and never could quite get it to work, but gamma_ray's i did get to work just fyi.
On a separate note but related to this subject, is there any recommended way to keep track of people and their character multi's.
I am trying figure out the best way for managing this is, wheter its a database. Or just setup a variable inside a variable of people and their char names.
Example:
ixy -=Ed=-
bob -=Ed=-
spy -=Ed=-
tril -=Jack=-
xue -=Jack=-
I know how to do the sub's on names etc, where -=Name=- would be subed in on the character ixy, or bob , or xue. So i can keep track of who is who.
The easier to manage the better, like a few simple commands of add (character name) (person name). And the same to remove the character, and so on.
If anyone has any ideas on how best to start on this please let me know.
Thanks. |
|
|
|
Fang Xianfu GURU
Joined: 26 Jan 2004 Posts: 5155 Location: United Kingdom
|
Posted: Mon Oct 01, 2007 4:01 am |
#var names ""
#alias addname {#addkey names %1 %2}
This is a data record variable. I'm not sure how those work in triggers, though (if you were to use {@names} in a trigger pattern) - I think it's just the keys that're used to match. |
|
|
|
Arminas Wizard
Joined: 11 Jul 2002 Posts: 1265 Location: USA
|
Posted: Mon Oct 01, 2007 3:04 pm |
Just like Fang said.
Make a database variable with all of the names. Use the doubles name as the keys.
Jake -> Original char
Joey -> Double
Leo -> Double
Using Fang's Alias above slightly edited.
#alias addname {#addkey names %1 %2;#T- SubName;#T+ SubName}
Addname Leo Jake
Addname Joey Jake
Do not add Jake to the Variable though as he is the Original.
Then make a REGEX trigger.
With the pattern of
\b(%expanddb(@names,'|','|'))\b
And the value of
#sub %1%if(%iskey(@names,%1)," "-=@names.%1=-)
#cw 12
Go the the options tab and put SubName in the ID box.
The color can be any you like or none at all. I used 12 because I like the bright red for my enemies.
Then when you see one of the doubles.
The mud sends.
Joey the master thief is here.
You see.
Joey -=Jake=- the master thief is here.
The mud sends.
Jake the master carpenter is here.
You see.
Jake the master carpenter is here.
Edit: There appears to be a bug in the regex or the parser somewhere. After deleting the trigger and recreating it this did not work. I will attempt to make one that works every time and repost the trigger pattern. |
|
_________________ Arminas, The Invisible horseman
Windows 7 Pro 32 bit
AMD 64 X2 2.51 Dual Core, 2 GB of Ram |
|
|
|
irmalaki Newbie
Joined: 10 Sep 2007 Posts: 7
|
Posted: Mon Oct 01, 2007 3:12 pm |
Thanks, that makes it a bit more clear for me now. Ill give it a whirl and see.
Thanks a ton for all the help. |
|
|
|
irmalaki Newbie
Joined: 10 Sep 2007 Posts: 7
|
Posted: Mon Oct 01, 2007 3:41 pm |
I have the variable setup and i have it triggering properly, and i have it isolated down all the
way to what i want the subed texte to be. I just need to figure out how to address the specific
name in the @names variable so i can have it show the original name, plus the subbed name.
If that makes any sense at all.
Meaning when the name is in the list it triggers it it shows the original name but then -=()=- inside the parenthesis it lists all the members of the variable. |
|
|
|
Arminas Wizard
Joined: 11 Jul 2002 Posts: 1265 Location: USA
|
Posted: Mon Oct 01, 2007 4:20 pm |
Ok, I refined what I had above.
Code: |
#ALIAS addname {#addkey names %1 %2;#untrigger SubName;#gag;#REGEX "SubName" {\b(%expanddb(@names,'|','|'))\b} {#sub {~%1~%if(~%iskey(~@names,~%1),~" -=(~"~@names.~%1~")=-~")};#cw 12}} |
This code creates an alias. The alias when used creates the variable you need and the trigger that goes with it.
So if you want to edit the trigger you will need to edit the alias. Each time you run the alias it deletes and recreates the trigger.
Sorry this is the easiest way to do what you wanted. Turning on and off the trigger was not causing it to recompile as I had hopped it would. |
|
_________________ Arminas, The Invisible horseman
Windows 7 Pro 32 bit
AMD 64 X2 2.51 Dual Core, 2 GB of Ram |
|
|
|
irmalaki Newbie
Joined: 10 Sep 2007 Posts: 7
|
Posted: Mon Oct 01, 2007 4:29 pm |
Ok, i used that and it works great. Im new to all this programing stuff only taking c++ and java atm. Still not a clue how you did that.
Thanks again , now i can be a super spy and keep track of everyone on game. |
|
|
|
Arminas Wizard
Joined: 11 Jul 2002 Posts: 1265 Location: USA
|
Posted: Mon Oct 01, 2007 10:31 pm |
Ok, on re-reading your post. I believe I have recreated exactly what you wanted.
Code: |
#ALIAS addname {#addkey names %proper( %1) %proper( %2);Spys=%dups( %expanddb( @names, '|', '|'))}
#REGEX {\b(@spys)\b} {Spy=%exec( "#loopdb @names {#if ((%db( @names, %1)=%val) or (%1=%val)) {%key}};#if (!%iskey( @names, %1)) {%1} {%db( @names, %1)}");Spy=%concat( %1, " -=(", @spy, ")=-");#sub {@spy};#cw 12} |
This one creates two more variables than the other one. But it is easier to understand AND it tells you every name that you have for a spy.
I might even post this one in the finished scripts forum. |
|
_________________ Arminas, The Invisible horseman
Windows 7 Pro 32 bit
AMD 64 X2 2.51 Dual Core, 2 GB of Ram |
|
|
|
|
|