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
Iteki
Newbie


Joined: 25 Aug 2002
Posts: 6
Location: Sweden

PostPosted: Sun Feb 23, 2003 11:18 am   

Help with a complicated (?) script please
 
Hi,

I want to make a script that will compare IPs on people entering my mud. I can't really work out how to do it as I am not the best with triggers.

As people enter the world the following log item is shown, example:
<LOG: (45) CharName[96.97.98.99] has connected.>

This shows level, name and IP.
I would like my script to send after this info the names of any other chars who have connected from the same IP. I rekon this should be easy enough to do with a database (if you know how). So I guess what I need the script to do is to take the name and the IP and compare them to a database. If the info isn't alread in the database it should make a post for it, if it is it should say what other names have connected from that IP.

Does anyone think they can make up something like that? Thanks in advance! Iteki
Reply with quote
Vijilante
SubAdmin


Joined: 18 Nov 2001
Posts: 5182

PostPosted: Sun Feb 23, 2003 1:05 pm   
 
A pretty easy one, I made it double entry so you could also get a feel for just how static someone IP is. The whole thing is MXP enabled, so you get a list of people who have used that IP immediately and can click or mouse-over for more data about those chars.

#CLASS {IPTracker}
#ALIAS IPHistory {HistoryLine="IP-%1:";#FORALL %db(@IPData,%1) { HistoryLine=%concat(%expand(@HistoryLine,1),"<SEND 'CharHistory ",%i,"' '",%expandlist(%db(@IPData,%i)," - "),"'>",%i,"</SEND> ")};#MXP @HistoryLine}
#ALIAS CharHistory {HistoryLine="Char-%1:";#FORALL %db(@IPData,%1) { HistoryLine=%concat(%expand(@HistoryLine,1),"<SEND 'IPHistory ",%i,"' '",%expandlist(%db(@IPData,%i)," - "),"'>",%i,"</SEND> ")};#MXP @HistoryLine}
#VAR IPData {}
#VAR HistoryLine {} {}
#TRIGGER {^~<LOG: ~(%d~) (%w)~[(%x)~] has connected.~>} {#ADDKEY IpData {%2} {%dups(%additem("%1",%db(@IPData,"%2")))};#ADDKEY IpData {%1} {%dups(%additem("%2",%db(@IPData,"%1")))};IPHistory {%2}}
#CLASS 0
Reply with quote
Iteki
Newbie


Joined: 25 Aug 2002
Posts: 6
Location: Sweden

PostPosted: Sun Feb 23, 2003 3:50 pm   
 
WOW! Testing that now, what is MXP enabled?
Reply with quote
Iteki
Newbie


Joined: 25 Aug 2002
Posts: 6
Location: Sweden

PostPosted: Sun Feb 23, 2003 4:03 pm   
 
Should I have said that I am using zmud 6.16?
I put this into a new class, and nothing really happens? Sorry for being such a n00b.
Reply with quote
Vijilante
SubAdmin


Joined: 18 Nov 2001
Posts: 5182

PostPosted: Sun Feb 23, 2003 11:00 pm   
 
Ok Everything I used except %expandlist is in 6.16. Quick change to make it work in 6.16:

#CLASS {IPTracker}
#ALIAS IPHistory {HistoryLine="IP-%1:";#FORALL %db(@IPData,%1) { HistoryLine=%concat(%expand(@HistoryLine,1),"<SEND 'CharHistory ",%i,"' '",%replace(%db(@IPData,%i),"|"," - "),"'>",%i,"</SEND> ")};#MXP @HistoryLine}
#ALIAS CharHistory {HistoryLine="Char-%1:";#FORALL %db(@IPData,%1) { HistoryLine=%concat(%expand(@HistoryLine,1),"<SEND 'IPHistory ",%i,"' '",%replace(%db(@IPData,%i),"|"," - "),"'>",%i,"</SEND> ")};#MXP @HistoryLine}
#VAR IPData {}
#VAR HistoryLine {} {}
#TRIGGER {^~<LOG: ~(%d~) (%w)~[(%x)~] has connected.~>} {#ADDKEY IpData {%2} {%dups(%additem("%1",%db(@IPData,"%2")))};#ADDKEY IpData {%1} {%dups(%additem("%2",%db(@IPData,"%1")))};IPHistory {%2}}
#CLASS 0
Reply with quote
Iteki
Newbie


Joined: 25 Aug 2002
Posts: 6
Location: Sweden

PostPosted: Sun Feb 23, 2003 11:26 pm   
 
Thank you, much appreciated :) You just made a tired little imm very happy!

I am going to try and work out what you did there so I can learn something to boot ;)
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