Register to post in forums, or Log in to your existing account
 

Play RetroMUD
Post new topic  Reply to topic     Home » Forums » zMUD General Discussion
Tommy2143
Beginner


Joined: 10 Aug 2002
Posts: 17

PostPosted: Sat Aug 10, 2002 8:13 am   

Randomly Deleting Triggers
 
OK I have these autoattack triggers for MajorMUD, and randomly, without any reason I can see, they delete themselves, and no they are NOT set to temp

^Also here~: (%w) (%w) (%w) (%w).
#if (@combat = 0) { #if (%ismember(%2 %3 %4,@enemylist)) {attack %2 %3 %4
#t- autoattack
#wait 1000
#t+ autoattack
}
}

That's the trigger, except the Also Here line changes, and the %1 and such change accordingly, it's supposed to recognize all possible room instances
If anyone knows a reason in that trigger it would be doing that, PLEASE let me know
Reply with quote
LightBulb
MASTER


Joined: 28 Nov 2000
Posts: 4817
Location: USA

PostPosted: Sat Aug 10, 2002 3:12 pm   
 
There is nothing in this trigger that would cause it to delete either itself or any other setting. The problem must be elsewhere in your script. What (other) triggers are being deleted?

This trigger probably won't work very well anyway. There would have to be at least four names (or other words) after "Also here:", if there's only three the pattern won't match. If there's five or more, the extra names will be ignored.

MUD output: Also here: Tommy LightBulb Kjata Vijilante Matt
%1 is Tommy, %2 is LightBulb, %3 is Kjata, %4 is Vijilante, Matt gets missed.
#IF (%ismember(%2 %3 %4,@enemylist) becomes
#IF (%ismember(LightBulb Kjata Vijilante,@enemylist) which is only true if "LightBulb Kjata Vijilante" is a single item in the list. Just having the individual names somewhere in the list isn't enough. In the unlikely event that you do get a match, the command sent to the MUD will be:
attack LightBulb Kjata Vijilante

This is probably closer to what you actually want.
#TR {^Also here: (*)} {#IF (@combat = 0) {#LOOP %numwords(%1) {#IF (%ismember(%word(%1,%i),@enemylist)) {attack %word(%1,%i)}}}}

LightBulb
Senior Member
Edited to add %word function
Reply with quote
Vijilante
SubAdmin


Joined: 18 Nov 2001
Posts: 5182

PostPosted: Sat Aug 10, 2002 4:10 pm   
 
Hrm MajorMud you say. I suppose I could just post the Combat section of my script, but getting everything it needs untangled from everywhere else would be quite difficult.

Here is the Combat stuff:
#CLASS {System|Combat} {enable}
#ALIAS Attack {#TZERO;#IF (@Attacking>0) {#ABORT 1};#IF (@Attacking=0) {Attacking=1};TempTarg="";#IF (%numitems(@MobList)) {#FORALL @PriorityAttack {#IF %pos(%i,@MobList) {TempTarg=%i}};#IF (@TempTarg!="") {MobList=%delitem(@TempTarg, @MobList)} {#FORALL @MobList { #IF ((%ascii(%i)<97)&(%numwords(%i)=1)) {#DELITEM MobList %i} {#IF (%ismember(%word(%i,1),@Descriptives)) { TempTarg=%trim(%remove(%word(%i,1),%i))} {TempTarg=%i};TempNote=%i;#IF %ismember(@TempTarg,@DontAttack2) {#DELITEM MobList %i} { #LOOP %numwords(@TempTarg) { #IF (%ismember(%word(@TempTarg,%i),@DontAttack)) { #DELITEM MobList @TempNote}}};TempNote=""}} //preforms check for thing not to attack;TempTarg="";#IF %numitems(@MobList) { #IF ((%ascii(%item(@MobList,1))>96))|(%numwords(%item(@MobList,1)>1)) { TempTarg=%pop(MobList)}}}};AttString="";#IF (%word(@TempTarg,%numwords(@TempTarg))="dwarf") { TempTarg=""} { #IF %pos("royal guard", @TempTarg) { #IF (%pos("dark-elf", @TempTarg)|(%pos("mermex",@TempTarg))) {} { TempTarg=""}} { #IF %pos("kang", @TempTarg) { #IF %pos("feral", @TempTarg) {} { TempTarg=""}}}};#IF (@TempTarg="") { #IF %numitems(@MobList) { #IF ((%ascii(%item(@MobList,1))>96))|(%numwords(%item(@MobList,1)>1)) { TempTarg=%pop(MobList)}}} { AttString=%concat(@AttCommand, " ", @TempTarg)};#WHILE ((@AttString="")&(%numitems(@MobList))) {#IF (%word(@TempTarg,%numwords(@TempTarg))="dwarf") {TempTarg=""} { #IF %pos("royal guard", @TempTarg) { #IF (%pos("dark-elf", @TempTarg)|(%pos("mermex",@TempTarg))) {} { TempTarg=""}} { #IF %pos("kang", @TempTarg) { #IF %pos("feral", @TempTarg) {} {TempTarg=""}}}};#IF (@TempTarg="") { #IF %numitems(@MobList) { #IF ((%ascii(%item(@MobList,1))>96))|(%numwords(%item(@MobList,1)>1)) { TempTarg=%pop(MobList)}}} { AttString=%concat(@AttCommand, " ", @TempTarg)}} //special cases;#IF (%trim(@AttString)!="") {LastSwingTime=%ctime;#TZ;AttSend} { #IF (@Attacking=1) {Attacking=0}}}
#ALIAS AttSend {#IF (@AttString!="") {#T+ Attacking1;#ALARM "TempCombat" {+2} {#IF (@Attacking=1) {TempTarg="a";AttSend}} "Temps";#IF (%trigger(Spells)) {CheckSpells ATTACKSPELL};@AttString;#IF (@Attacking=0) {Attacking=1}}}
#ALIAS CleanMobList {MobList=%remove("Also here: ",@MobList);MobList=%remove(".",@MobList);MobList=%replace(@MobList,"*","");MobList=%replace(@MobList,", ","|");Moblist=%replace(@MobList," |","|");MobList=%trim(@MobList);PlayersInRoom="";#FORALL @MobList { #IF (%ismember(%i,@PlayersInRealm)) {#DELITEM MobList %i;#ADDITEM PlayersInRoom %i} { #IF (%ismember(%i,@KnownPlayers)) {#DELITEM MobList %i;#ADDITEM PlayersInRoom %i;#ADDITEM PlayersInRealm %i}}};#IF (%trigger(PartyControl)) {PartyChecks};#IF (@Attacking=5) {Attacking=0};#IF (@Attacking=0) {Attack} { #IF (@Attacking>0) { MobList=%delitem(%copy(@AttString,%eval(%len(@AttCommand)+2),255),@MobList)}}}
#VAR Attacking {0}
#VAR DontAttack2 {shifty dwarf|hooded traveller|sleazy shopkeeper|nasty-looking man|shadowy healer|crippled adventurer|warrior spirit|witchunter spirit|mystic spirit|ranger spirit|young girl|priest spirit|cleric spirit|paladin spirit|missionary spirit|ninja spirit|thief spirit|bard spirit|gypsy spirit|warlock spirit|mage spirit|druid spirit|wounded worker|aged titan|greasy thief|grizzled trainer|plagued prisoner|ghost knight|water spirit|stone sphinx|grey portal|giant otter|huge fungus creature|shadow guard|mangy dog|black cat|drunken brawler|filthy beggar|drunken gambler|diamond guardian|royal soldier|haunting spirit|old man|gaunt one|carriage headmaster|rock eater|wandering cleric|insect swarm|bishop|priest|Mayor Godfrey}
#VAR MobList {}
#VAR PriorityAttack {Champion of Blood|Goru-Nezar|Lord of the Hunt|Gulgulthra|Leo the Quick|Pharaoh Rastep|Dao Lord|Enigma Lord}
#VAR AttString {}
#VAR LastSwingTime {0}
#VAR DontAttack {dwarven|gnome|healer|guardsman|townsman|townswoman|cardinal|bluejay|raven|squirrel|barmaid|gypsy|dummy|woodelf|shopkeeper|faerie|treant|unicorn|bodyguard|nekojin|amazon|wounded|Templar|boatman|ferryman|nomad|prisoner|catoblepas|seeress|dying}
#VAR Descriptives {tall|fat|short|fierce|angry|big|large|nasty|elite|small|thin|happy}
#TRIGGER {(%w) moves to attack (*)%p$} {#IF ("%2"="you") { #IF (%pos( "A", %roomflags)=0) { #DISCONNECT} { #NOOP arenas are fine}} { #IF (%trigger(PartyControl)) { #IF (%ismember("%1",@PartyMembers)) { #IF ((@Attacking=0)&(@MobList="")) {Attacking=5;AttString="new mob";%null}}}}}
#TRIGGER {~*Combat Off~*} {#IF (@Attacking=3) {Attacking=0;AttString="new mob";#IF (%numitems(@MobList)) { Attack} { %null}} { #IF (@Attacking=2) { #IF (@TempTarg!="a") {TempTarg=a;Attacking=1;#T- Attacking2;AttSend}} { #IF (@Attacking=-1) { %null}}}}
#TRIGGER {(*) you{r | }*for %d damage!$} {#ADD MobSwings 1;#IF ((@Attacking=0)&(@IsBlind=0)) { #IF ((%numitems(@Moblist)=0)&(@AttString!="new mob")) {Attacking=5;AttString="new mob";#IF (@last!="none") { #ALARM {+1} {%null}} { %null}}} { #IF (@Attacking=0) {AttString=%concat(@AttCommand," ", %word("%1",2));AttSend}}}
#TRIGGER {(*) {at|towards|for} you*!$} {#IF (%pos("dodge",%trigger)|%pos("duck",%trigger)) { #ADD Dodge 1};#ADD MobSwings 1;#IF ((@Attacking=0)&(@IsBlind=0)) { #IF ((%numitems(@Moblist)=0)&(@AttString!="new mob")) {Attacking=5;AttString="new mob";#IF (@last!="none") { #ALARM {+1} {%null}} { %null}}} { #IF (@Attacking=0) {AttString=%concat(@AttCommand," ",%word("%1",2));AttSend}}}
#CLASS 0

#CLASS {System|Combat|Attacking1} {disable}
#TRIGGER {~*Combat Engaged~*} {#IF (@Attacking=1) {#UNTRIGGER TempCombat;Attacking=2;#IF (@TempTarg=a) {TempTarg=""};#T- Attacking1;#T+ Attacking2}}
#TRIGGER {{You don't see your target here!|You are overcome with a feeling of guilt and break off your attack}$} {#IF (@Attacking>0) {#UNTRIGGER TempCombat;Attacking=0;AttString="";%null;#T- Attacking1}}
#TRIGGER {To do this action, you must turn off your evil warnings.$} {#IF (@Attacking=1) {#UNTRIGGER TempCombat;Attacking=0;#IF (%numitems(@MobList)) {Attack};#T- Attacking1}}
#TRIGGER {(*) moves to protect (*)$} {MobList=%concat("%2","|",%delitem("%1",@MobList));TempTarg="%1";AttString=%concat(@AttCommand," ","%1")}
#CLASS 0

#CLASS {System|Combat|Attacking2} {disable}
#TRIGGER {You gain (%d) experience.$} {#TZ;#IF (@Attacking=2) {Attacking=3;#T- Attacking2};#ADD EXPGained %1}
#TRIGGER {You (*)!$} {#IF (%pos(" for ","%1")&%pos(" damage","%1")) {#TZ;#ADD Hits 1;#ADD Swings 1;LastSwingTime=%ctime;#LOOP %numwords("%1") { #IF %isnumber(%word("%1",%i)) { ADDB DamDealt %number(%word("%1",%i))}};#IF %pos("critically", "%1") {#ADD Crits 1}} { #IF %pos(%word("%1",%numwords("%1")),@AttString) {#TZ;#ADD Swings 1;LastSwingTime=%ctime}}}
#CLASS 0

Now that doesn't include the trigger to capture the mobs. So to write a quick one:
#TR {^Also here: (*)} {MobList="%1";#IF (%ends(@MobList,".")=0) {#T+ CaptureMobList} {CleanMobList}}
#TR "CaptureMobList {^(*)$} {MobList=%concat(@MobList," ","%1");#IF (%ends(@MobList,".")) {#T- CaptureMobList;CleanMobList}}

Now things you will have to set that are elsewhere KnownPlayers it is a list of player names, without it the combat section will try to attack players; AttCommand is the command your character uses to attack; and you will have to put these in for damage tracking.

#ALIAS ADDB {#IF (!%defined("%1")) {#ABORT 1};#IF (%number(%2)<1) {#ABORT 1};TempBigNumber=%numitems(@%1);#VAR %1 {%replaceitem(%eval(%number(%item(@%1,@TempBignumber))+%2), @TempBigNumber,@%1)};#WHILE (@TempBigNumber) { #IF (%number(%item(@%1,@TempBigNumber))>1000) {#IF (@TempBigNumber>1) {#VAR %1 {%replaceitem(%eval(%number(%item(@%1, %eval(@TempBigNumber-1)))+%number(%leftback(%item(@%1, @TempBignumber),3))),%eval(@TempBigNumber-1),@%1)};#VAR %1 {%replaceitem(%rightback(%item(@%1,@TempBignumber),3), @TempBigNumber,@%1)}} {#VAR %1 {%replaceitem(%concat(%leftback(%item(@%1,1),3), ":",%rightback(%item(@%1,1),3)),1,@%1)};#VAR %1 {%replace(@%1,":","|")}};#ADD TempBigNumber -1} { TempBigNumber=0}}}
#ALIAS DIVB {#IF (!%defined("%1")) {#ABORT 1};#IF (%number(%2)<1) {#ABORT 1};TempBigNumber=%concat(%eval(%number(%item(@%1,1))/%2),"|", %eval(%number(%item(@%1,1))%2),"|1");#WHILE (%item(@TempBigNumber,3)<%numitems(@%1)) {TempBigNumber=%replaceitem(%eval(%number(%item(@TempBigNumber,3))+1), 3,@TempBigNumber);TempBigNumber=%replaceitem(%concat(%item(@TempBigNumber,1), ":", %eval((%number(%item(@%1,%item(@TempBigNumber, 3)))+%eval(1000*%number(%item(@TempBigNumber, 2))))/%2)),1,@TempBigNumber);TempBigNumber=%replaceitem(%mod((%number(%item(@%1, %item(@TempBigNumber,3)))+%eval(1000*%number(%item(@TempBigNumber, 2)))),%2),2,@TempBigNumber)};#VAR %1 {%replace(%item(@TempBigNumber,1),":","|")}}
#ALIAS SHOB {#IF (!%defined("%1")) {#ABORT 1};TempBigNumber="";#FORALL @%1 { TempBigNumber=%concat(@TempBigNumber,%replace(%format("&3.0f",%i)," ","0"))};#WHILE (%left(@TempBigNumber,1)="0") { TempBigNumber=%right(@TempBigNumber,1)};#VAR %1 @TempBigNumber}

And finally a button to turn it off.
#BUTTON 1 {AutoAttack %if(@Attacking=-1,Off,On)} {#IF (@Attacking=-1) {Attacking=0} {Attacking=-1};AttString=""} {} {} {} {} {} {Size} {80} {23} {} {} {} {124} {} {} {} "" {} {} {}

I hope I found everywhere it is tied to my script for ya. A little explanation, DontAttack contains single words for mobs that shouldn't be attacked. That allows you to not attack any dwarves in Khaz just by one word "dwarven". DontAttack2 contains full names of mobs less descriptives, that is for those unique mobs, and for classes of mob where either word in thier name being in the first would cause you to not attack something hostile. PriorityAttack lets you specify that you want to kill some guy first.
Reply with quote
Tommy2143
Beginner


Joined: 10 Aug 2002
Posts: 17

PostPosted: Sun Aug 11, 2002 7:35 am   
 
Ok umm.. that is all very complicated, heh
But responding to LightBulb, that wouldnt happen because I have multiple triggers setup to recognize various combinations of words and such
MajorMUD has monster names of anything from 1-3 words, plus a random/optional description word, so the longest possible monster name is 4 words, and 3 of the words are the name. Also, all monsters/chars are seperated by a comma.
So I have triggers to look for rooms of one monster, and each trigger checks a different amount of words, and then triggers that allow for more people in the room
And no other triggers react that should have any effect on those. They have their own class, and no other class manipulates it.
Btw, the #wait is what keeps ALL the triggers from firing when I enter a largely filled room
Reply with quote
LightBulb
MASTER


Joined: 28 Nov 2000
Posts: 4817
Location: USA

PostPosted: Sun Aug 11, 2002 9:46 pm   
 
In that case, you might need to enclose %2 %3 %4 in delimiters. I still don't see anything in this trigger that would cause it to delete itself or any other trigger. Perhaps you just meant it wasn't firing (due the #WAIT), rather than actually being deleted.

#IF (%ismember("%2 %3 %4",@enemylist)) {attack %2 %3 %4}

LightBulb
Senior Member
Reply with quote
Tommy2143
Beginner


Joined: 10 Aug 2002
Posts: 17

PostPosted: Tue Aug 13, 2002 8:18 am   
 
No trust me, it was deleted
When I went to look at the triggers, they were gone
Only some of them, not all of them
I am perplexed myself
Reply with quote
MattLofton
GURU


Joined: 23 Dec 2000
Posts: 4834
Location: USA

PostPosted: Tue Aug 13, 2002 10:36 pm   
 
quote:

No trust me, it was deleted
When I went to look at the triggers, they were gone
Only some of them, not all of them
I am perplexed myself



How did you check to see if they were present? Some folks have reported problems where settings would appear in some instances and not in others, depending on how you were viewing the settings file. These people discovered triggers and such this way that they had thought disappeared.

If you are sado enough, you should easily be able to find the missing settings if you exported the entire settings file to text. The exporter does not miss a thing, but it's very format-unfriendly.

li'l shmoe of Dragon's Gate MUD
Reply with quote
Display posts from previous:   
Post new topic   Reply to topic     Home » Forums » zMUD General Discussion All times are GMT
Page 1 of 1

 
Jump to:  
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

© 2009 Zugg Software. Hosted by Wolfpaw.net