Notice: Any messages purporting to come from this site telling you that your password has expired, or that you need to verify your details, confirm your email, resolve issues, making threats, or asking for money, are
spam. We do not email users with any such messages. If you have lost your password you can obtain a new one by using the
password reset link.
Due to spam on this forum, all posts now need moderator approval.
Entire forum
➜ MUSHclient
➜ Perlscript
➜ Evaluating triggers with user-specified string from script?
Evaluating triggers with user-specified string from script?
|
It is now over 60 days since the last post. This thread is closed.
Refresh page
Posted by
| j0nas
(56 posts) Bio
|
Date
| Tue 03 Jun 2003 11:19 AM (UTC) |
Message
| Would it be possible for me to call a function from within a script, for example '$world->evaluatetriggers("You're hungry.");' and have MUSHClient react like it just recieved that very string from the world and evaluate it for trigger-matches and fire off scripts etc etc, just like it would do normally?
The reason I'm asking is that I've got a 200Mb+ log-file that I'd love to parse through my new MUSHClient-script and it's triggers, as if MUSHClient had just recieved those lines as input. Perhaps there's a much better way to do this though, I'm open to suggestions. | Top |
|
Posted by
| Poromenos
Greece (1,037 posts) Bio
|
Date
| Reply #1 on Tue 03 Jun 2003 12:41 PM (UTC) |
Message
| I don't know if that's possible, but it would be nice if you could do it. I could then easily write a search/replace plugin for searching in files using regex :p cool function... |
Vidi, Vici, Veni.
http://porocrom.poromenos.org/ Read it! | Top |
|
Posted by
| Ked
Russia (524 posts) Bio
|
Date
| Reply #2 on Tue 03 Jun 2003 03:37 PM (UTC) |
Message
| well, the way I do it is by using Shadowfyr's Phantom server. What this little gadget does is simply echo whatever you type in the input window back to the output. So basically it's an echo server. The only drawback to this is that logfiles don't save all that ANSI markup, which is processed by MUclient behind the scenes, so you get prompts without normal colours, etc. Not a big deal though if all you want to do is test the scripts and triggers.
Search the forum for Phantom and you'll find a link to it.
After installing, run it, change the port number in it's little window to whatever you want, change the world's IP to localhost or 127.0.0.1 in your world settings and click on the connect button. Then just paste your file (probably will have to do it in chunks, since processing 1k lines normally takes around 10 seconds on my PII-200 and you don't want to crash your computer) into the input window and hit enter. | Top |
|
Posted by
| Nick Gammon
Australia (23,133 posts) Bio
Forum Administrator |
Date
| Reply #3 on Tue 03 Jun 2003 09:38 PM (UTC) |
Message
| What I did when I was benchmarking MUSHclient (timing it) was make a logfile like you describe, using the "raw log" ability.
Then I copied that to a Linux PC, logged in to it with MUSHclient (ie. connected using port 23) and then typed:
cat mylogfile
This basically sent the logfile to MUSHclient which then evaluated all its triggers etc.
If you don't have Linux handy, you could probably do the same thing with Cygwin, however I don't have that installed right now to say for sure. You would need the telnet daemon running (telnetd).
Or, get a Windows telnet daemon (eg. from TuCows) - I know there are some around - and do the same thing with that.
Failing that, take the "tiny mud server" I did (source on this site) and write a new command "test" that reads your log file in and sends the lot to the connected player.
|
- Nick Gammon
www.gammon.com.au, www.mushclient.com | Top |
|
Posted by
| j0nas
(56 posts) Bio
|
Date
| Reply #4 on Tue 03 Jun 2003 09:55 PM (UTC) |
Message
| Oh yes, catting it from a linux-machine has to be the best solution for files this size. That'll be just perfect, thanks. | Top |
|
Posted by
| Poromenos
Greece (1,037 posts) Bio
|
Date
| Reply #5 on Wed 04 Jun 2003 12:12 AM (UTC) |
Message
| I just found out that VBScript has a regular expression object. Quoting the example from the scripting helpfile:
function matchDemo(){
var s;
var re = new RegExp("d(b+)(d)","ig");
var str = "cdbBdbsbdbdz";
var arr = re.exec(str);
s = "$1 contains: " + RegExp.$1 + "\n";
s += "$2 contains: " + RegExp.$2 + "\n";
s += "$3 contains: " + RegExp.$3;
return(s);
}
|
Vidi, Vici, Veni.
http://porocrom.poromenos.org/ Read it! | Top |
|
Posted by
| Nick Gammon
Australia (23,133 posts) Bio
Forum Administrator |
Date
| Reply #6 on Wed 04 Jun 2003 06:28 AM (UTC) |
Message
| Yes, there are a few posts here about using that. Handly if you want more than 10 wildcards, for example.
However the original post was to see what his existing triggers did with a log file, and unless you recoded each trigger using the VBscript regexp parser, it wouldn't quite do that. |
- Nick Gammon
www.gammon.com.au, www.mushclient.com | Top |
|
Posted by
| Magnum
Canada (580 posts) Bio
|
Date
| Reply #7 on Sun 08 Jun 2003 05:07 PM (UTC) |
Message
| For anybody interested in Shadowfyr's program, I am currently hosting it here:
http://www.MagnumsWorld.com/Muds/ |
Get my plugins here: http://www.magnumsworld.com/muds/
Constantly proving I don't know what I am doing...
Magnum. | Top |
|
The dates and times for posts above are shown in Universal Co-ordinated Time (UTC).
To show them in your local time you can join the forum, and then set the 'time correction' field in your profile to the number of hours difference between your location and UTC time.
22,092 views.
It is now over 60 days since the last post. This thread is closed.
Refresh page
top