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
DeathDealer
Adept


Joined: 20 Jul 2004
Posts: 268

PostPosted: Wed Apr 06, 2005 3:03 pm   

#loop #alarm not pausing **SOLVED** (well enuf for me)
 
Using a finder script, from a fellow Aardwolfian, to do where's on mobs with same names in areas.

#LOOP {@findlow, @findhigh} {where %i.@findmob}

The thing is is that it it just sends them all in a rush with no pause inbetween, leading to confusion as to which mob # is which room.

Tried this:
#LOOP {@findlow, @findhigh} {#ALARM +1 {where %i.@findmob}}

But all it does is wait one second and then sends them all in a rush anyways.
Thought maybe one second was to short so tested it with 10 seconds...waits 10 then sends all in a rush.
Tried #ALARM +1;where %i.@findmob and where %i.@findmob;#ALARM +1 just for laughs and giggles as well. Nada :(
I'd thought that the point of the #loop was that it would go thru the command to be executed and do it hence making it wait until each alarm wears off.

The funny thing is that it don't even send them in order with the #alarm, it just scrambles it up a little:
where 5.raj
where 9.raj
where 8.raj
where 7.raj
where 6.raj
where 4.raj
where 3.raj
where 2.raj
where 1.raj
_________________


Last edited by DeathDealer on Fri Apr 08, 2005 4:00 pm; edited 1 time in total
Reply with quote
Maelstrom
Apprentice


Joined: 10 Feb 2005
Posts: 158

PostPosted: Wed Apr 06, 2005 3:45 pm   
 
The loop completes almost instantly. So you will create multiple alarms all going off at once.
One possible way (which may or may not be ideal) would be to use %i as the time to fire also. This should give a one second delay between each loop...

#LOOP {@findlow,@findhigh} {#ALARM +%i {where %i.@findmob}}
Reply with quote
DeathDealer
Adept


Joined: 20 Jul 2004
Posts: 268

PostPosted: Wed Apr 06, 2005 3:52 pm   
 
Actually that works great!
The one downside to it is that since i can set the range, if i do a search of mobs 15 to 30 i gotta wait 15secs for the 1st look, but ya know what, that's not bad at all anyways.
_________________
Reply with quote
Maelstrom
Apprentice


Joined: 10 Feb 2005
Posts: 158

PostPosted: Wed Apr 06, 2005 4:05 pm   
 
Ahh good point, hows this then? Might not be syntantically correct but im sure you get the idea...

#LOOP {@findlow,@findhigh} {#ALARM +(%i-@findlow+1) {where %i.@findmob}}
Reply with quote
DeathDealer
Adept


Joined: 20 Jul 2004
Posts: 268

PostPosted: Wed Apr 06, 2005 6:26 pm   
 
yeah, syntax on it is
#LOOP {@findlow, @findhigh} {#ALARM +%eval( %i-@findlow+1) {where %i.@findmob}}

And it works on 2 outta 3 tries....that's REALLY weird...

alias syntax:

find mob
find mob #
find mob # #

type find mob and it goes from 1.mob to 15.mob automatially and with the delay.
type find mob # and it goes from #.mob to #+15.mob automatially and with the delay.
type find mob # # and thats where it goes weird....

find sweep 20 30
(wait about 20 seconds)
where 20.0
You didn't find any 20.0
where 21.0
You didn't find any 21.0
where 22.0
You didn't find any 22.0

At least after the 20 seconds it goes off every second like it should.
This is the code part for it:
Code:
#IF {%3} {
  #CLASS {AutoTrack}
  #VARIABLE findmob {%1}
  #VARIABLE findlow {%2}
  #VARIABLE findhigh {%3}
  #CLASS 0
  #ECHO Checking for @findmob in range @findlow - @findhigh
  #LOOP {@findlow, @findhigh} {#ALARM +%eval( %i-@findlow+1) {where %i.@findmob}}
  #CLASS {AutoTrack}
  #VARIABLE findmob {0}
  #VARIABLE findlow {0}
  #VARIABLE findhigh {0}
  #CLASS 0
  }


Now, here's the kicker...if i take out the:
#CLASS {AutoTrack}
#VARIABLE findmob {0}
#VARIABLE findlow {0}
#VARIABLE findhigh {0}
#CLASS 0
part, the code works PERFECT, WITHOUT the delay!!
It don't make sense to me why it only has an issue with here and not in the other 2...
Either way, I took out the zero'ing bit from all 3 parts of the #if, and put it at the begining of the whole thing, and it runs great.
Just weird...
_________________
Reply with quote
MattLofton
GURU


Joined: 23 Dec 2000
Posts: 4834
Location: USA

PostPosted: Wed Apr 06, 2005 11:46 pm   
 
You could probably get rid of the loop and use a permanent alarm. The alarm will ensure you only send one command per second, and via counters and stuff in the alias you could set up terms for disabling the alarm so it's not always on.

#alias find {#if (%numparam()) {Findmob = "%1#if (%null(%2)) {Findlow = 1} {Findlow = %2};#if (%null(%3)) {Findhigh = %eval(@findlow + 15)} {Findhigh = %3};FindCounter = @Findlow;#T+ talmFindMobs} {#noop whatever you wanted to do for just FIND}}

#alarm "talmFindMobs" *1 {#if (@Findcounter <= @Findhigh) {where @Findcounter~.@FindMob} {#noop @Findcounter is greater than @Findhigh, so reset and disable alarm;FindCounter = 0;#T- talmFindMobs}}

Because of the Variable.field syntax, you might have problems with the where command so you may have to fiddle with that.
_________________
EDIT: I didn't like my old signature
Reply with quote
Maelstrom
Apprentice


Joined: 10 Feb 2005
Posts: 158

PostPosted: Thu Apr 07, 2005 2:11 am   
 
Try this one on for size...

Code:

#CLASS findall
    #CLASS AutoTrack
        #VAR findmob {}
        #VAR findlow {}
        #VAR findhigh {}
    #CLASS 0

    #ALIAS find {
        #VARIABLE findmob {%1}
        #VARIABLE findlow {%if(%null(%2),1,%2)}
        #VARIABLE findhigh {%if(%null(%3),15,%3)}
        #ECHO {Checking for @findmob in range @findlow - @findhigh}
        #ALARM +1 {rfind @findmob @findlow @findhigh}}
    }

    #ALIAS rfind {
        #IF (%2<=%3) {
            #SEND {where %2.%1}
            #ALARM +1 {rfind %1 %eval(%2+1) %3}
    }
#CLASS 0


Shocked
Reply with quote
DeathDealer
Adept


Joined: 20 Jul 2004
Posts: 268

PostPosted: Thu Apr 07, 2005 3:20 am   
 
Maelstrom 2 things, and one question,
1st thing, ya missed a } to close the rfind alias
2nd thing:
find questor 10
Checking for questor in range 10 - 15
find questor 20
Checking for questor in range 20 - 15
The point of it was to go from 1 to 15, or from # to #+15 or from #1 to #2

The question is did you mean to have the
#CLASS AutoTrack
#VAR findmob {}
#VAR findlow {}
#VAR findhigh {}
#CLASS 0
part in there or just the
#VAR findmob {}
#VAR findlow {}
#VAR findhigh {}
?

--------

And Matt
you have {Findmob = "%1#if (%n
I'll take a guess that you meant "%1";#if (%n
Either way, the results come out like this:
find raj
where 1.raj
where 1.raj
where 1.raj
find raj 10
where 10.raj
where 10.raj
where 10.raj
find raj 1 2
where 1.raj
where 1.raj
where 1.raj
none of them seem to work, and on top of that don't ever seem to stop until i uncheck the exectute mark on the alarm.
_________________
Reply with quote
Maelstrom
Apprentice


Joined: 10 Feb 2005
Posts: 158

PostPosted: Thu Apr 07, 2005 12:02 pm   
 
Quote:
1st thing, ya missed a } to close the rfind alias


Good catch...

Quote:
The point of it was to go from 1 to 15, or from # to #+15 or from #1 to #2


Ohhh, ok now I get it... from your original post I was a little confused on this point. See below.

Code:

#CLASS findall
    #VAR findmob {}
    #VAR findlow {}
    #VAR findhigh {}

    #ALIAS find {
        #VARIABLE findmob {%1}
        #VARIABLE findlow {%if(%null(%2),1,%2)}
        #VARIABLE findhigh {%if(%null(%3),%if(%null(%2),15,%eval(%2+15)),%3)}
        #ECHO {Checking for @findmob in range @findlow - @findhigh}
        #ALARM +1 {rfind @findmob @findlow @findhigh}}
    }

    #ALIAS rfind {
        #IF (%2<=%3) {
            #SEND {where %2.%1}
            #ALARM +1 {rfind %1 %eval(%2+1) %3}
        }
    }
#CLASS 0


This should properly get the ranges correct although I did not test it.
Reply with quote
DeathDealer
Adept


Joined: 20 Jul 2004
Posts: 268

PostPosted: Thu Apr 07, 2005 8:24 pm   
 
AWESOME! tried, tested, loved!

Thanks!
_________________
Reply with quote
Atreides_096
Wanderer


Joined: 21 Jan 2005
Posts: 99
Location: Solvang, CA

PostPosted: Thu Apr 07, 2005 8:24 pm   
 
There is actually an EXTREMELY simple solution to this problem. Though you wouldn't know it unless you played Aardwolf, or another MUD with a similar feature.

Aardwolf supports MUD-side self-only echoes. The command is "echo" and allows you to echo back to yourself. Thus the fix to the script is:

#loop {1, 15} {where %{i}.hornet;#send echo ~@GThe last mob was: ~@Y%i.@findmob.~@w}

The ~@G and ~@Y and ~@w are color codes :P

You might want to modify the loop to go 1-10 in this case, because of the added spam (I tested it with #send, that command does not seem to work inside of a loop)...
Reply with quote
MattLofton
GURU


Joined: 23 Dec 2000
Posts: 4834
Location: USA

PostPosted: Thu Apr 07, 2005 10:47 pm   
 
Whoops. Forgot to put the incrementor in with the where command. Simply add in #add FindCurrent 1 behind the where command and it should increment properly (I always have trouble remembering what the results look like so you MAY have to place this command BEFORE the where command instead of after, but that's no biggie.)
_________________
EDIT: I didn't like my old signature
Reply with quote
DeathDealer
Adept


Joined: 20 Jul 2004
Posts: 268

PostPosted: Fri Apr 08, 2005 1:47 pm   
 
Atreides_096, like I mentioned to ya, the echo will still flash spam it to aard resulting in the 1st one or 2 to be at the top of a screen that might have scrolled and the others to be at the bottom. like ya said, every second counts in a GQ and to have to scroll to see the others would take the seconds.
Even tho the 1 sec (even the .5 sec delay) is also a time cost.
Here's a question, how about a #sub?
send a where %{i}.hornet and comes up with
1.mob ----> room
2.mob ----> room
where the ----> is all the spaces that aard gives (tho mob(%s)room #sub %2 {---->} would be nice as well....*ponder*

MattLofton, haven't tried yours yet. I'll check and do an edit to the note to reflect results. Thanks.
EDIT: Matt, dunno, but it still keeps doing the same # over and over, even with the #add. Thanks anways :-)
_________________
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