|
Tabrin Newbie
Joined: 29 Jul 2004 Posts: 4
|
Posted: Mon Aug 02, 2004 4:30 pm
#DELITEM |
Okay, I'm working on a script that will store Clanned playernames into a variable, and from there figure out if they're in a clan I war and wether or not they are in my PK range, and highlight them appropriately.
I see this:
[44 Asn] [ Shadow ] Tsion Novice
And my trigger is this:
#tr {^~[(%d) %2~] ~[ Shadow ~]%s(%x)%s(*)} {#ADDITEM Shadow_Clanners {SHADOW:%3:%1:%2:%4}}
So what I get is a variable looks something like this:
SHADOW:Tsion:40:Asn:Novice
SHADOW:Jenkins:35:War:Knight:Templar
etc, etc.
However, when someone levels, and my trigger captures their new level....I get this:
SHADOW:Tsion:40:Asn:Novice
SHADOW:Tsion:42:Asn:Novice
Here's the second trigger I have, which triggers off of a #showdb @Shadow_Clanners:
SHADOW:(%w):(%d):(%w):(%w)
And the command:
#var Temp %1
#var Temp2 %2
#if (@warclans=Shadow) {#if %abs( @level-@temp2)<9 {#ADDITEM Range_Clan @temp} {#ADDITEM War_Clan @temp}} {#noop}
#if ((@friendlyclans=Shadow) {#additem Friendly_clan @temp} {#noop}
Basically that sees if I war Shadow, or not, then sticks their name into seperate varibles to be triggered off of elsewhere. But that's not the problem. I think.
What I want to know is if there's a way I can delete all instances of say, {SHADOW:(%w):(%d):(%w):(%w)} from a db/variable before I add a new one.
So I tried to do this to the first trigger:
#Delitem Shadow_Clanners {SHADOW:%1:(%d):%3:(%w)}
#ADDITEM Shadow_Clanners {SHADOW:%3:%1:%2:%4}
However it wouldn't work, and I kinda figured it wouldn't. Any ideas on what I need to do for this?
Or, heck. If there's a different or easier way I could be handling this project, feel free to say it. :P |
|
|
|
LightBulb MASTER
Joined: 28 Nov 2000 Posts: 4817 Location: USA
|
Posted: Mon Aug 02, 2004 7:17 pm |
These aren't db-variables (record-variables), they are list-variables. Record-variables might work better. They are made with the #ADDKEY command, rather than #ADDITEM which makes lists. You can use the name as the key for each record. #ADDKEY overwrites records with the same key, so using the name as the key will remove any previous records. The rest of the information can go in the value as a list, in the order: guild|level|class|rank. This will allow you to access the individual items of each record using list functions.
#TR {^~[(%d) (%w)~] ~[ Shadow ~]%s(%x)%s(*)} {#ADDK Shadow_Clanners {%3} {SHADOW|%1|%2|%4}}
#SHOWDB @Shadow_Clanners
will then give the following output (using your sample names):
Tsion: SHADOW|40|Asn|Novice
Jenkins: SHADOW|35|War|Knight Templar
You can use that output for your second trigger.
#TR {(%w): {@warclans}|(%d)|%w|%x} {#IF (%abs( @level - %2) < 9) {#ADDI Range_Clan %1} {#ADDI War_Clan %1}}
You could also skip both the #SHOWDB and the second #TRIGGER by using an alias to loop through the variable.
#AL Shadowloop {#LOOPDB @Shadow_Clanners {#IF (%abs( @level - %number( %item( %val, 2))) < 9) {#ADDI Range_Clan %key} {#ADDI War_Clan %key}}} |
|
_________________ LightBulb
Senior member
Most scripts in this forum are written for Command Line entry.
Don't even open the Settings Editor unless its use is specified or obvious. |
|
|
|
Tabrin Newbie
Joined: 29 Jul 2004 Posts: 4
|
Posted: Tue Aug 03, 2004 12:42 pm Update |
Okay, that worked beautifully. Thanks. :)
However, I needed to make it so that it would be tri-state: Friendly, In range(Enemy), Out of range(Enemy). Friendly In/Out range wouldn't hurt either, but eh.
So I edited it to this:
#AL Shadowloop {#LOOPDB @Shadow_Clanners {#if (Shadow=@Friendlyclan) {#ADDI Friendly_Clan %key} {#IF (%abs( @level - %number( %item( %val, 2))) < 9) {#ADDI Range_Clan %key} {#ADDI War_Clan %key}}}}
However, while it seems that the syntax is correct, ie #if (condition) {True} {False} zmud will always put a friendly clanner that is in my pk range into the Range_Clan record, and not in the Friendly_Clan record ...which it should not be doing because the range_clan part is a nested if in the false portion of the trigger.
I tried making the shadowloop into this, but it still didn't seem to work:
#LOOPDB @Shadow_Clanners {#if (Shadow=@Friendlyclan) {#ADDI Friendly_Clan %key}} {}
#LOOPDB @Shadow_Clanners {#if (Shadow=@Warclans) {#IF (%abs( @level - %number( %item( %val, 2))) < 9) {#ADDI Range_Clan %key} {#ADDI War_Clan %key}}}
Here are all the aliases and triggers and whatnot, by the way.
#tr {^~[(%d) (%w)~] ~[ Talon ~]%s(%x)%s(*)} {#ADDK Talon_Clanners {%3} {Talon|%1|%2|%4}; Talonloop}
#tr {^~[(%d) (%w)~] ~[ Loner ~]%s(%x)%s(*)} {#ADDK Loner_Clanners {%3} {Loner|%1|%2|%4}; Lonerloop}
#tr {^~[(%d) (%w)~] ~[ Wargar ~]%s(%x)%s(*)} {#ADDK Wargar_Clanners {%3} {Wargar|%1|%2|%4}; Wargarloop}
#tr {^~[(%d) (%w)~] ~[ Shadow ~]%s(%x)%s(*)} {#ADDK Shadow_Clanners {%3} {Shadow|%1|%2|%4}; Shadowloop}
#tr {^~[(%d) (%w)~] ~[ Justice ~]%s(%x)%s(*)} {#ADDK Justice_Clanners {%3} {Justice|%1|%2|%4}; Justiceloop}
#tr {^~[(%d) (%w)~] ~[ Bloodlust ~]%s(%x)%s(*)} {#ADDK Bloodlust_Clanners {%3} {Bloodlust|%1|%2|%4}; Bloodlustloop}
#tr {^~[(%d) (%w)~] ~[ Shalonesti ~]%s(%x)%s(*)} {#ADDK Shalonesti_Clanners {%3} {Shalonesti|%1|%2|%4}; Shalonestiloop}
#tr {^~[(%d) (%w)~] ~[ Knighthood ~]%s(%x)%s(*)} {#ADDK Knighthood_Clanners {%3} {Knighthood|%1|%2|%4}; Knighthoodloop}
#tr {^~[(%d) (%w)~] ~[ Red Robes ~]%s(%x)%s(*)} {#ADDK Conclave_Red_Robe_Clanners {%3} {Conclave_Red_Robe|%1|%2|%4}; Conclave_Red_Robeloop}
#tr {^~[(%d) (%w)~] ~[ Black Robes ~]%s(%x)%s(*)} {#ADDK Conclave_Black_Robe_Clanners {%3} {Conclave_Black_Robe|%1|%2|%4}; Conclave_Black_Robeloop}
#tr {^~[(%d) (%w)~] ~[ White Robes ~]%s(%x)%s(*)} {#ADDK Conclave_White_Robe_Clanners {%3} {Conclave_White_Robe|%1|%2|%4}; Conclave_White_Robeloop}
#tr {{@War_Clan}} {#cw 12} {To_Highlight}
#tr {{@Range_Clan}} {#cw 64} {To_Highlight}
#tr {{@Friendly_Clan}} {#cw 48} {To_Highlight}
#tr {{@Loner_Clan}} {#cw 14} {To_Highlight}
#tr {{@Loner_Range_Clan}} {#cw 110} {To_Highlight}
#AL Lonerloop {#LOOPDB @Loner_Clanners {#IF (%abs( @level - %number( %item( %val, 2))) < 9) {#ADDI Loner_Range_Clan %key} {#ADDI Loner_Clan %key}}}
#AL Talonloop {#LOOPDB @Talon_Clanners {#if (Talon=@Friendlyclan) {#ADDI Friendly_Clan %key} {#IF (%abs( @level - %number( %item( %val, 2))) < 9) {#ADDI Range_Clan %key} {#ADDI War_Clan %key}}}}
#AL Shadowloop {#LOOPDB @Shadow_Clanners {#if (Shadow=@Friendlyclan) {#ADDI Friendly_Clan %key} {#IF (%abs( @level - %number( %item( %val, 2))) < 9) {#ADDI Range_Clan %key} {#ADDI War_Clan %key}}}}
#AL Wargarloop {#LOOPDB @Wargar_Clanners {#if (Wargar=@Friendlyclan) {#ADDI Friendly_Clan %key} {#IF (%abs( @level - %number( %item( %val, 2))) < 9) {#ADDI Range_Clan %key} {#ADDI War_Clan %key}}}}
#AL Justiceloop {#LOOPDB @Justice_Clanners {#if (Justice=@Friendlyclan) {#ADDI Friendly_Clan %key} {#IF (%abs( @level - %number( %item( %val, 2))) < 9) {#ADDI Range_Clan %key} {#ADDI War_Clan %key}}}}
#AL Bloodlustloop {#LOOPDB @Bloodlust_Clanners {#if (Bloodlust=@Friendlyclan) {#ADDI Friendly_Clan %key} {#IF (%abs( @level - %number( %item( %val, 2))) < 9) {#ADDI Range_Clan %key} {#ADDI War_Clan %key}}}}
#AL Shalonestiloop {#LOOPDB @Shalonesti_Clanners {#if (Shalonesti=@Friendlyclan) {#ADDI Friendly_Clan %key} {#IF (%abs( @level - %number( %item( %val, 2))) < 9) {#ADDI Range_Clan %key} {#ADDI War_Clan %key}}}}
#AL Knighthoodloop {#LOOPDB @Knighthood_Clanners {#if (Knighthood@Friendlyclan) {#ADDI Friendly_Clan %key} {#IF (%abs( @level - %number( %item( %val, 2))) < 9) {#ADDI Range_Clan %key} {#ADDI War_Clan %key}}}}
#AL Conclave_Red_Robeloop {#LOOPDB @Conclave_Red_Robe_Clanners {#if (Conclave_Red_Robe=@Friendlyclan) {#ADDI Friendly_Clans %key} {#IF (%abs( @level - %number( %item( %val, 2))) < 9) {#ADDI Range_Clan %key} {#ADDI War_Clan %key}}}}
#AL Conclave_Black_Robeloop {#LOOPDB @Conclave_Black_Robe_Clanners {#if (Conclave_Black_Robe=@Friendlyclan) {#ADDI Friendly_Clan %key} {#IF (%abs( @level - %number( %item( %val, 2))) < 9) {#ADDI Range_Clan %key} {#ADDI War_Clan %key}}}}
#AL Conclave_White_Robeloop {#LOOPDB @Conclave_White_Robe_Clanners {#if (Conclave_White_Robe=@Friendlyclan) {#ADDI Friendly_Clan %key} {#IF (%abs( @level - %number( %item( %val, 2))) < 9) {#ADDI Range_Clan %key} {#ADDI War_Clan %key}}}}
#tr {xyz123} {#add temp 1; #cw @temp; #say @temp}
#var level 40
#var Warclans {Shadow|Wargar|Bloodlust}
#var Friendlyclan {Talon|Wargar|Conclave_White_Robe_Clanners}
#SAY ~[40 Asn] ~[ Talon ] FInRange1 Novice
#SAY ~[51 Asn] ~[ Talon ] FOutRange1 Novice
#SAY ~[40 Asn] ~[ Bloodlust ] EInRange Novice
#SAY ~[51 Asn] ~[ Bloodlust ] EOutRange Novice
#SAY ~[40 Asn] ~[ Loner ] Lonerinr Novice
#SAY ~[51 Asn] ~[ Loner ] Loneroutr Novice |
|
|
|
LightBulb MASTER
Joined: 28 Nov 2000 Posts: 4817 Location: USA
|
Posted: Tue Aug 03, 2004 7:42 pm |
Quote: |
#var Warclans {Shadow|Wargar|Bloodlust}
#var Friendlyclan {Talon|Wargar|Conclave_White_Robe_Clanners}
|
Shadow isn't in @Friendlyclan, but even if it was it wouldn't EQUAL @Friendlyclan. It would only EQUAL @Friendlyclan if there were no other clans listed.
The correct condition is %ismember.
#IF %ismember( Shadow, @Friendlyclan) {#SAY Friend} {#SAY Foe} |
|
_________________ LightBulb
Senior member
Most scripts in this forum are written for Command Line entry.
Don't even open the Settings Editor unless its use is specified or obvious. |
|
|
|
Tabrin Newbie
Joined: 29 Jul 2004 Posts: 4
|
Posted: Wed Aug 04, 2004 3:41 am |
I'll try that when I get home from work. I had thought that you could do var1=@bob when bob was something like {var1|var2}, I guess I was wrong.
Eh. :P
Another odd thing is when I add/remove Knighthood from @Friendlyclan, it will /always/ highlihght as friend out of range. Go figure.
next I'll see if I can get all the
#tr {^~[(%d) (%w)~] ~[ Talon ~]%s(%x)%s(*)} {#ADDK Talon_Clanners {%3} {Talon|%1|%2|%4}; Talonloop}
#tr {^~[(%d) (%w)~] ~[ Loner ~]%s(%x)%s(*)} {#ADDK Loner_Clanners {%3} {Loner|%1|%2|%4}; Lonerloop}
triggers in one trigger, that will addkey and loop appropriately. Hmm. |
|
|
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|