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


Joined: 13 Jul 2002
Posts: 51
Location: Malaysia

PostPosted: Mon Sep 16, 2002 8:56 pm   

Mob Pinger
 
I have a mob pinger set..
But have encountered some errors..
I dunno why but when i hit the aliasses they Don't work.....
#CLASS {Pinger} {enable}
#ALIAS mobadd {#ADDKEY pin_mobs %1 %1;#ADDKEY pin_state %1 Up;#ADDKEY pin_uptime %1 0;#ADDKEY pin_lastrep %1 -1;#ADDKEY pin_reptime %1 -1;gt Pinger Report -> %1 aded to pinglist.}
#ALIAS mobdel {#DELKEY pin_mobs %1;#DELKEY pin_state %1;#DELKEY pin_uptime %1;#DELKEY pin_lastrep %1;#DELKEY pin_reptime %1;gt Pinger Report -> %1 removed from pinglist.;}
#ALIAS showmobs {grouptell Mob Name State TtR LstRep ReppTm;grouptell ------------------- --------- ------- -------- --------;#LOOPDB @pin_mobs {#IF (%db( @pin_lastrep, %val) != -1) {#VA pin_lastrepop %eval(-%db( @pin_lastrep, %val))} {#VA pin_lastrepop %null};#VA pin_ttr %eval(%db( @pin_reptime, %val) - %db( @pin_lastrep, %val));#VA pin_repop %db( @pin_reptime, %val);#IF (%db( @pin_reptime, %val) = -1) {#VA pin_repop %null;#VA pin_ttr %null};#IF (@pin_lastrepop != %null AND @pin_repop != %null) {grouptell %format("&18s &4s:&2.0n &4.0n &5.0n &4.0n", %val, %db( @pin_state, %val), %db( @pin_uptime, %val) , @pin_ttr, @pin_lastrepop, @pin_repop)};#IF (@pin_lastrepop != %null AND @pin_repop = %null) {grouptell %format("&18s &4s:&2.0n &5.0n ", %val, %db( @pin_state, %val), %db( @pin_uptime, %val) ,@pin_lastrepop)};#IF (@pin_lastrepop = %null AND @pin_repop = %null) {grouptell %format("&18s &4s:&2.0n ", %val, %db( @pin_state, %val), %db( @pin_uptime, %val) ,@pin_lastrepop)}}}
#ALIAS checkmobs2 {#VA pin_pinged 0;#IF (@pin_curmob) {#VA pin_check 0} {#VA pin_check 1};#LOOPDB @pin_mobs { #IF (@pin_check = 1) {tell %key ping;#VA pin_pinged 1;#VA pin_check 0;#VA pin_curmob %key} { #IF (@pin_curmob = %key) {#VA pin_check 1}}};#IF (@pin_pinged = 0) {#VA pin_curmob ""}}
#ALIAS checkmobs {#VA pin_curmob "";checkmobs2}
#ALIAS updatemobs {#LOOPDB @pin_mobs {#ADDKEY pin_uptime %val %eval(%db( @pin_uptime, %val)+1)};#LOOPDB @pin_mobs {#IF (%db( @pin_lastrep, %val) > -1) {#ADDKEY pin_lastrep %val %eval(%db( @pin_lastrep, %val)+1)}}}
#VAR pin_state {}
#VAR pin_enabled {1}
#VAR pin_reptime {}
#VAR pin_uptime {}
#VAR pin_lastrep {}
#VAR pin_mobs {}
#VAR pin_check {1} {0}
#VAR pin_curmob {}
#VAR pin_pinged {0} {0}
#VAR pin_ttr {}
#VAR pin_repop {}
#VAR pin_lastrepop {}
#TRIGGER {No-one by that name here..} {#IF (@pin_curmob) {#IF (%db( @pin_state, @pin_curmob) = "Up") {#ADDKEY pin_uptime @pin_curmob 0};#ADDKEY pin_state @pin_curmob Down};checkmobs2}
#TRIGGER {You tell * 'ping'} {#IF (@pin_curmob) {#IF (%db( @pin_state, @pin_curmob) = "Down") {#ADDKEY pin_uptime @pin_curmob 0;#IF (%db( @pin_lastrep, @pin_curmob) > -1) {#ADDKEY pin_reptime @pin_curmob %db( @pin_lastrep, @pin_curmob)};#ADDKEY pin_lastrep @pin_curmob 0;gt Pinger Report -> @pin_curmob is up.};#ADDKEY pin_state @pin_curmob Up};checkmobs2}
#CLASS 0





Cameth
Saweth
Fledeth my asseth offeth
Reply with quote
Toetag
Magician


Joined: 10 Oct 2000
Posts: 356
Location: USA

PostPosted: Tue Sep 17, 2002 12:43 am   
 
Put each line into a text file and import them in one at a time. Figure out which one it doesn't like, or if it's a combination it doesn't like.

I had about 40 lines of settings that wouldn't import and it turned out when I imported them one at time, they took and worked without error.

Killing a fly on a friends forhead may not be overkill, use a hatchet to make sure the job is done.
Reply with quote
Vijilante
SubAdmin


Joined: 18 Nov 2001
Posts: 5182

PostPosted: Tue Sep 17, 2002 2:19 am   
 
I had no problems copying and pasting that in, and everything appeared to function apropiately.
Reply with quote
Retrovirus
Wanderer


Joined: 13 Jul 2002
Posts: 51
Location: Malaysia

PostPosted: Tue Sep 17, 2002 8:17 pm   
 
Ok Ok It works..
I wonder... is there a way to do a search on the %db based on keywords

For example....

mobadd retrovirus
Pinger :Added an entry for retrovirus
mobadd : araceli
Pinger :Added an entry for araceli

ZweiRan tells you 'ping r'
tell Zweiran Retrovirus Up:x Ttr and other info...
tell Zweiran Araceli Up:x Ttr and other info.

Cameth
Saweth
Fledeth my asseth offeth
Reply with quote
Vijilante
SubAdmin


Joined: 18 Nov 2001
Posts: 5182

PostPosted: Tue Sep 17, 2002 10:44 pm   
 
#VAR QueryList {}
#ALIAS QueryMobs {#IF (%null("%1")) {#ECHO QueryMobs:Arugement required.} {QueryList="";#LOOPDB @pin_mobs {#IF (%pos("%1",%key)) {#ADDITEM QueryList {%key}}}}}

Of the top of my head that is an alias to preform a query on your mob db variable. You can use #FORALL and %db to display the data about those mobs. Alternately you can take that alias apart and have it display the data immediately instead of adding the mob name to an intermediate list.
Reply with quote
Retrovirus
Wanderer


Joined: 13 Jul 2002
Posts: 51
Location: Malaysia

PostPosted: Wed Sep 18, 2002 3:12 pm   
 
Thanks Vijilante, ok another addition...
%w tells you 'pingadd dork'
tell %1 'Pinger : Added an entry for Dork.'
%w tells you 'ping me'
tell %1 'His Mobs'...

Basically i want to tell him about his mobs when he does ping me.
But how do i make zmud classify which mob is who's??

Do i make any sense?

Cameth
Saweth
Fledeth my asseth offeth
Reply with quote
Vijilante
SubAdmin


Joined: 18 Nov 2001
Posts: 5182

PostPosted: Thu Sep 19, 2002 12:14 am   
 
Change your db structure slightly. Right now you store every mobs name as both the key and value in pin_mobs. If you were to instead store a characters name, as the value then you can modify that query alias to extract those that match the character name.

As for the pingadd just change the gt in the alias to check for %2=%null, if it is use the gt, other send a tell to %2, then you would have your trigger do "mobadd dork Dufus"
Reply with quote
Retrovirus
Wanderer


Joined: 13 Jul 2002
Posts: 51
Location: Malaysia

PostPosted: Sat Sep 21, 2002 3:16 pm   
 
Confusing need more help vijilante....
Also i want something like this
lets say mob Retro is in pinglist..
another dude comes along and does pingadd retro

I want to tell him, Sorry the entry 'Retro' is already in the pinglist..
How does one do this?

Cameth
Saweth
Fledeth my asseth offeth
Reply with quote
Vijilante
SubAdmin


Joined: 18 Nov 2001
Posts: 5182

PostPosted: Sat Sep 21, 2002 5:01 pm   
 
First the change in your db handling.
#ALIAS mobadd {#ADDKEY pin_mobs %1 %if(%null(%2),Retrovirus,%2);#ADDKEY pin_state %1 Up;#ADDKEY pin_uptime %1 0;#ADDKEY pin_lastrep %1 -1;#ADDKEY pin_reptime %1 -1;#IF (%null(%2)) {gt Pinger Report -> %1 aded to pinglist.} {tell %2 Pinger: Added entry for %1}}

Next we change the Query to also retrieve requesting player
#VAR QueryList {}
#ALIAS QueryMobs {#IF (%null("%1")) {#ECHO QueryMobs:Arugement required.} {QueryList="";#LOOPDB @pin_mobs {#IF ("%1"="-ANY") {#IF ("%2"=%val) {#ADDITEM QueryList {%key}}} {#IF (%pos("%1",%key)) {#ADDITEM QueryList {%key}}}}}}

Now we can make the player interface trigger
#TR {(%w) tells you 'ping (*)'} {#IF ("%2"="help") {tell %1 Valid commands are: add mobname, query mobname/partial, and mine} {#IF ("%2"="mine") {QueryMobs -ANY %1;tell %1 You have added mobs: %replace(@QueryList,"|",", ")} {#IF (%word("%2",1)="add") {#IF (%numwords("%2")=1) {tell %1 Mobname required for add command} {QueryMobs %word("%2",2);#IF (%null(@QueryList)) {mobadd %word("%2",2) %1} {tell %1 It seems that %replace(@QueryList,"|",", ") is already in ping system.}}} {#IF (%word("%2",1)="query") {#IF (%numwords("%2")=1) {tell %1 Mobname or partial name required for query command} {QueryMobs %word("%2",2);#IF (%null(@QueryList)) {tell %1 No such mob is known to me.} {#ECHO put in LOOPDB and tells here}}}}}}}

You will have to put in the reporting of mob specific on query return, but other then that I think I got everything you wanted.
Reply with quote
Retrovirus
Wanderer


Joined: 13 Jul 2002
Posts: 51
Location: Malaysia

PostPosted: Sat Sep 21, 2002 9:45 pm   
 
#ALIAS mobadd {#ADDKEY pin_mobs %1 %if(%null(%2),Retrovirus,%2)

hrm confused, what's up with the Retrovirus thing up there?

Cameth
Saweth
Fledeth my asseth offeth
Reply with quote
Vijilante
SubAdmin


Joined: 18 Nov 2001
Posts: 5182

PostPosted: Sun Sep 22, 2002 1:44 am   
 
That just puts your name in the value if none was specified, you could change that to be %1, Vijilante, or anything else for that matter. You could also take it out entirely, but I am not sure how ADDKEY behaves when presented with a null value, and can't bothered to test it.
Reply with quote
Retrovirus
Wanderer


Joined: 13 Jul 2002
Posts: 51
Location: Malaysia

PostPosted: Sun Sep 22, 2002 3:25 pm   
 
I added you as you said and here's the problem......
Weasel tells you 'pingadd wixen'
tell weasel Added an entry for "WEASEL"
Weasel tells you 'pingadd x'
tell weasel Sorry, Entry for "WEASEL" exists
.....

Cameth
Saweth
Fledeth my asseth offeth
Reply with quote
Vijilante
SubAdmin


Joined: 18 Nov 2001
Posts: 5182

PostPosted: Sun Sep 22, 2002 8:22 pm   
 
I put it all together for you into one easy import class. Only change was to remove some quotes from the QueryMobs, they seemed to be causing some trouble, although for the life of me I can't tell why.

#CLASS {Pinger} {"enable"}
#ALIAS mobadd {#ADDKEY pin_mobs %1 %if(%null(%2),Retrovirus,%2);#ADDKEY pin_state %1 Up;#ADDKEY pin_uptime %1 0;#ADDKEY pin_lastrep %1 -1;#ADDKEY pin_reptime %1 -1;#IF (%null(%2)) {gt Pinger Report -> %1 aded to pinglist.} {tell %2 Pinger: Added entry for %1}}
#ALIAS mobdel {#DELKEY pin_mobs %1;#DELKEY pin_state %1;#DELKEY pin_uptime %1;#DELKEY pin_lastrep %1;#DELKEY pin_reptime %1;gt Pinger Report -> %1 removed from pinglist.;}
#ALIAS showmobs {grouptell Mob Name State TtR LstRep ReppTm;grouptell ------------------- --------- ------- -------- --------;#LOOPDB @pin_mobs {#IF (%db( @pin_lastrep, %val) != -1) {#VA pin_lastrepop %eval(-%db( @pin_lastrep, %val))} {#VA pin_lastrepop %null};#VA pin_ttr %eval(%db( @pin_reptime, %val) - %db( @pin_lastrep, %val));#VA pin_repop %db( @pin_reptime, %val);#IF (%db( @pin_reptime, %val) = -1) {#VA pin_repop %null;#VA pin_ttr %null};#IF (@pin_lastrepop != %null AND @pin_repop != %null) {grouptell %format("&18s &4s:&2.0n &4.0n &5.0n &4.0n", %val, %db( @pin_state, %val), %db( @pin_uptime, %val) , @pin_ttr, @pin_lastrepop, @pin_repop)};#IF (@pin_lastrepop != %null AND @pin_repop = %null) {grouptell %format("&18s &4s:&2.0n &5.0n ", %val, %db( @pin_state, %val), %db( @pin_uptime, %val) ,@pin_lastrepop)};#IF (@pin_lastrepop = %null AND @pin_repop = %null) {grouptell %format("&18s &4s:&2.0n ", %val, %db( @pin_state, %val), %db( @pin_uptime, %val) ,@pin_lastrepop)}}}
#ALIAS checkmobs2 {#VA pin_pinged 0;#IF (@pin_curmob) {#VA pin_check 0} {#VA pin_check 1};#LOOPDB @pin_mobs { #IF (@pin_check = 1) {tell %key ping;#VA pin_pinged 1;#VA pin_check 0;#VA pin_curmob %key} { #IF (@pin_curmob = %key) {#VA pin_check 1}}};#IF (@pin_pinged = 0) {#VA pin_curmob ""}}
#ALIAS checkmobs {#VA pin_curmob "";checkmobs2}
#ALIAS updatemobs {#LOOPDB @pin_mobs {#ADDKEY pin_uptime %val %eval(%db( @pin_uptime, %val)+1)};#LOOPDB @pin_mobs {#IF (%db( @pin_lastrep, %val) > -1) {#ADDKEY pin_lastrep %val %eval(%db( @pin_lastrep, %val)+1)}}}
#ALIAS QueryMobs {#IF (%null( "%1")) {#ECHO QueryMobs:Arugement required.} {QueryList="";#LOOPDB @pin_mobs { #IF (%1="-ANY") { #IF (%2=%val) { #ADDITEM QueryList {%key}}} { #IF (%pos( %1, %key)) { #ADDITEM QueryList {%key}}}}}}
#VAR pin_state {}
#VAR pin_enabled {1}
#VAR pin_reptime {}
#VAR pin_uptime {}
#VAR pin_lastrep {}
#VAR pin_mobs {}
#VAR pin_check {0} {0}
#VAR pin_curmob {}
#VAR pin_pinged {0} {0}
#VAR pin_ttr {}
#VAR pin_repop {}
#VAR pin_lastrepop {}
#VAR QueryList {}
#TRIGGER {No-one by that name here..} {#IF (@pin_curmob) {#IF (%db( @pin_state, @pin_curmob) = "Up") {#ADDKEY pin_uptime @pin_curmob 0};#ADDKEY pin_state @pin_curmob Down};checkmobs2}
#TRIGGER {You tell * 'ping'} {#IF (@pin_curmob) {#IF (%db( @pin_state, @pin_curmob) = "Down") {#ADDKEY pin_uptime @pin_curmob 0;#IF (%db( @pin_lastrep, @pin_curmob) > -1) {#ADDKEY pin_reptime @pin_curmob %db( @pin_lastrep, @pin_curmob)};#ADDKEY pin_lastrep @pin_curmob 0;gt Pinger Report -> @pin_curmob is up.};#ADDKEY pin_state @pin_curmob Up};checkmobs2}
#TRIGGER {(%w) tells you 'ping (*)'} {#IF ("%2"="help") {tell %1 Valid commands are: add mobname, query mobname/partial, and mine} {#IF ("%2"="mine") {QueryMobs -ANY %1;tell %1 You have added mobs: %replace(@QueryList,"|",", ")} {#IF (%word("%2",1)="add") {#IF (%numwords("%2")=1) {tell %1 Mobname required for add command} {QueryMobs %word("%2",2);#IF (%null(@QueryList)) {mobadd %word("%2",2) %1} {tell %1 It seems that %replace(@QueryList,"|",", ") is already in ping system.}}} {#IF (%word("%2",1)="query") {#IF (%numwords("%2")=1) {tell %1 Mobname or partial name required for query command} {QueryMobs %word("%2",2);#IF (%null(@QueryList)) {tell %1 No such mob is known to me.} {#ECHO put in LOOPDB and tells here}}}}}}}
#CLASS 0
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