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
mo24
Wanderer


Joined: 31 Jan 2006
Posts: 55

PostPosted: Wed Mar 08, 2006 3:56 pm   

#ALARM troubles
 
Hi, i'm having troubles with #ALARM.

I have a trigger. When the trigger fires from mud text, I would like it to call some aliases, but timed with #ALARM. I get a lot of text scrolling fast in the mud. This way, I hope it will not lag zMud so bad to process it since it will be timed.

I have tried many combinations, lastly this. Since there are many triggers happening quick, I need random ID names so I can make many simulteneous #ALARMs.

cntvar=%random( 1, 1000)
ktmp="tmp"@cntvar
#EXEC %concat( "#ALARM ", @ktmp, "~+1 ", "{myalias %1 ~= %2 ~= %3~}")

ktmp stores random #ALARM ID name, like tmp681 or tmp255. +1 is 1sec delay I want the alarm to wait before calling alias myalias. %1, %2, %3 are parameters gotten from trigger...

I cannot get it to work right. Many of the timers are firing, but they are not correct, like either wrong name, wrong time, wrong commands. Also my biggest problem, after triggers have fired, it leaves me with many DISABLED timers for no apparent reason. I then have to remove them all manually...

Anyone knows what I can do to get this to work right?
THanks Smile
Reply with quote
xenapan
Wanderer


Joined: 26 May 2004
Posts: 68

PostPosted: Wed Mar 08, 2006 6:06 pm   
 
i do NOT know if i can help but i would ask a few questions to clarify your problem.
1) why arent you using multiple triggers?
2) why do you need random ID names? last time i checked, that was automatically assigned
3) my guess is your aliases are giving the wrong commands because your trigger is matching the wrong pattern, and the syntax for the myalias with the parameters should be {myalias %1 %2 %3 %n}, by putting =, i think you are messing it up and creating variables of the name/number %1 is eg you would have @%1 = %2
4) it would be alot easier to have sample text from the mud, what you are matching, a brief explanation of what you want to do when it matches, what you do NOT want to match, etc.

for now, i would suggest you try fixing your trigger as such
#TR {yourpattern here} {#alarm +1 {myalias %1 %2 %n}}

that will possibly work.. depending on how much you are trying to match.
_________________
Player on Realms of Despair. realms.game.org port 4000. Join us today!
Reply with quote
TonDiening
GURU


Joined: 26 Jul 2001
Posts: 1958
Location: Canada

PostPosted: Wed Mar 08, 2006 9:30 pm   
 
Try:
#EXEC %concat( "#ALARM ", Spam%time( hhmmssz), " +1000 {myalias ", %1, " = ", %2, " = ", %3, "}")

this uses millisecond off the time for the alarm.

Much simpler perhaps.
Reply with quote
mo24
Wanderer


Joined: 31 Jan 2006
Posts: 55

PostPosted: Wed Mar 08, 2006 9:33 pm   
 
Sorry I should have explained better. I am trying to match, and check some file, using %grep to see if matches exist in there or not. But I do not get to the %greps before I have this problem. It is way before.

1- I am not sure.. I don't think I could use multiple triggers for this
2- I found just now I don't need different ID names, I only tried them thinking maybe that was why the alarms kept getting disabled, but no.
3- I tried replacing = with . but no difference.. i checked variable list but no variables called @%1 etc. the reason i need a character in between is so i can separate them in the alias once the alarm passes them. because sometimes each can be multiple words. Also to note I tried it with random #alarm times.. if I space them out very much like 3secs apart there is very little if no repeating. But then, this is not efficient because it is even slower than before.

I tried it with the example you gave. then #ECHOed some sample text to make trigger fire, to test it to see if it works. I put:
#TR { exact pattern} { #ALARM +1 {myalias %1 = %2 = %3}} (also tried . btw and ` as separators..)

And I put this in 'myalias' alias:
#echo test1: %-1
knum=%trim( %word( "%-1", 1, %char( 61)))
nnum=%trim( %word( "%-1", 2, %char( 61)))
anum=%trim( %word( "%-1", 3, %char( 61)))
#echo test2: @knum and @nnum and @anum

Ok.. now if I make four texts that scroll by fast on MUD and make the trigger fire, and use #ECHOs,I first see this in echos, which is correct:

test1: 5 = 2335 = Immortal Homes
test1: 9 = 5382 = New Thalos
test1: 2 = 1392 = Midgaard
test1: 6 = 1333 = Flying Citadel

But then the second echo is not!! If I give all timers same time (1 sec), all output look the same:

test2: 5 and 2335 and Immortal Homes
test2: 5 and 2335 and Immortal Homes
test2: 5 and 2335 and Immortal Homes
repeated..

If I give them different times it is more random, but still many duplicates. Like:
test1: 5 = 2335 = Immortal Homes
test1: 5 = 2335 = Immortal Homes
test1: 9 = 5382 = New Thalos
test1: 2 = 1392 = Midgaard
test1: 2 = 1392 = Midgaard
test1: 2 = 1392 = Midgaard

And after trigger fires and script is finished, and I type, #alarm to check alarms, I see (From 1 sec alarm example above):
+1 -> myalias 9 = 5382 = New Thalos (disabled)
+1 -> myalias 2 = 1392 = Midgaard (disabled)
+1 -> myalias 6 = 1333 = Flying Citadel (disabled)
Which is so annoying, because then I have to go into triggers and delete them by hand....

I also tried your example TonDiening but same result, disabled alarms and duplicate echos.

What could be causing this? Sad
Reply with quote
TonDiening
GURU


Joined: 26 Jul 2001
Posts: 1958
Location: Canada

PostPosted: Wed Mar 08, 2006 10:53 pm   
 
I've only seen this with #TEMP triggers firing a couple of times before they disappear.

EXEC %concat( "#ALARM ",@%2, " +1000 {myalias ", @%1, " = ", @%2, " = ", @%3, "}")

Maybe make the ALARM trigger use the ?vnum %2 or the name %replace(@%3," ","_")

Maybe that will make it overwrite existing triggers so you don't get duplicates.
Reply with quote
mo24
Wanderer


Joined: 31 Jan 2006
Posts: 55

PostPosted: Thu Mar 09, 2006 9:19 am   
 
It is not a #temp trigger unfortunately, I wish I could fix it so easy. I tried:

#EXEC %concat( "#ALARM ",@%2, " +1 {myalias ", @%1, " = ", @%2, " = ", @%3, "}")

But it did not work im afraid. alarms looked like:

+ myalias = = : @5382 -> +1 [in -943943559 secs]
+ myalias = = : @1392 -> +1 [in -943943559 secs]
etc.

Any other idea? I must find a way to process this script at leisure and prevent lag, whether through #ALARMs or another way. It is getting very laggy. I had to change my script already from using the zMud db to using file.txt and %grep instead for speed. but now, it seems that too is not good enough anymore. It is frustrating that one has to try 10 different things to get zMud to do what you want it to correctly. It seems so picky or maybe just buggy.
Reply with quote
TonDiening
GURU


Joined: 26 Jul 2001
Posts: 1958
Location: Canada

PostPosted: Thu Mar 09, 2006 9:40 pm   
 
zMud probably isn`t the best for this kind of task :)

Obviously from the -943943559 secs is showing that it has run out of time.

How about staggering the #alarms at a longer period or making a string list of items which you process afterwards?

Stagger
#EXEC %concat( "#ALARM ",@%2, " +",%random(30,60)," {myalias ", @%1, " = ", @%2, " = ", @%3, "}")
^
String list
#additem ToProcess {myalias @%1 = @%2 = @%3}

then when your grep is done you'd
#forall @toprocess {%i}
Reply with quote
Vijilante
SubAdmin


Joined: 18 Nov 2001
Posts: 5182

PostPosted: Fri Mar 10, 2006 1:20 am   
 
Perhaps if you explain what you are looking to do in detail including actual mud outputs, any data you are already working with and its format we can come up with something that works. Right now your trying to preform a bunch of complex tricks with #EXEC and something else and likely it isn't really helpful. It appears that the way in which your script is built is having problems with a variable being overwritten before it is used. My testing didn't have any direct problems.
Code:
#CLASS {testing}
#ALIAS test1 {#ALARM {+1} {test2 %-1}}
#ALIAS test3 {#ECHO "6 - 1333 - Flying Citadel";#ECHO "2 - 1392 - Midgaard";#ECHO "9 - 5382 - New Thalos";#ECHO "5 - 2335 - Immortal Homes"}
#ALIAS test2 {#echo test1: %-1;knum=%trim( %word( "%-1", 1, %char( 61)));nnum=%trim( %word( "%-1", 2, %char( 61)));anum=%trim( %word( "%-1", 3, %char( 61)));#echo test2: @knum and @nnum and @anum}
#TRIGGER {(%d) - (%d) - (*)} {test1 %1 = %2 = %3}
#CLASS 0
test3
Code:
6 - 1333 - Flying Citadel
2 - 1392 - Midgaard
9 - 5382 - New Thalos
5 - 2335 - Immortal Homes
test1: 6 = 1333 = Flying Citadel
test2: 6 and 1333 and Flying Citadel
test1: 5 = 2335 = Immortal Homes
test2: 5 and 2335 and Immortal Homes
test1: 9 = 5382 = New Thalos
test2: 9 and 5382 and New Thalos
test1: 2 = 1392 = Midgaard
test2: 2 and 1392 and Midgaard
_________________
The only good questions are the ones we have never answered before.
Search the Forums
Reply with quote
mo24
Wanderer


Joined: 31 Jan 2006
Posts: 55

PostPosted: Mon Mar 13, 2006 2:04 am   
 
I havent had much time to work on this problem more until tonight..

Vijilante I tried your script and it worked. hmm. but.. it does not take a lot of processing time like mine does... i think that is why mine is not working. i think my script is 100+ lines maybe 200? too much to post.. and in many aliases. i don't think it would help, because i even get confused when looking at it all when i want to change something...

Ok I maybe have narrowed it down. If I put #echo right in the first part of the script, the trigger, like this:

#TRIGGER {(*) - (*) - (*)} {
#echo %1 = %2 = %3
#ALARM +1 {myalias etc...
}

Even IT gives me duplicates in the echo! So maybe this is not a problem entirely with #ALARM after all...

Why would the trigger be duplicating like this, seeing the same values ? It seems like zmud is just hicupping and triggering before it updates itself. I have tried #PRIORITY in all aliases the script uses including this trigger thinking maybe this will solve it but no. Maybe it would if I could have the entire script inside the trigger instead of split up.. but that defeats my purpose of spacing it out to reduce lag !

Tondiening I am afraid with a string list it will still lag zMud, unless I put #ALARMs in it to space it out. Each process of the script lags a little. If I do one after another with no delay though it lags a lot!! and I am unable to do anything in zmud for a short while. This is why I need the script that processes the %greps spaced out a little. I will try your suggestion but I now found I will have to change my script a lot if I do Sad Yesterday I made it use #abort 1 to speed it up (to make it not having to go through all #IFs and #FORs etc.) and it seems that causes problems with processing the stringlist with #FOR. It processes only first element then halts both scripts. And I guess zMud does not have a command that would just halt one alias instead of all scripts either huh... Sad

Do you have any other idea what I could try to solve this? I am so discouraged.
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