[Home] [Downloads] [Search] [Help/forum]


Register forum user name Search FAQ

Gammon Forum

[Folder]  Entire forum
-> [Folder]  MUSHclient
. -> [Folder]  Perlscript
. . -> [Subject]  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] Refresh page


Posted by j0nas   (56 posts)  [Biography] 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.
[Go to top] top

Posted by Poromenos   Greece  (1,037 posts)  [Biography] 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!
[Go to top] top

Posted by Ked   Russia  (524 posts)  [Biography] 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.
[Go to top] top

Posted by Nick Gammon   Australia  (22,990 posts)  [Biography] 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
[Go to top] top

Posted by j0nas   (56 posts)  [Biography] 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.
[Go to top] top

Posted by Poromenos   Greece  (1,037 posts)  [Biography] 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!
[Go to top] top

Posted by Nick Gammon   Australia  (22,990 posts)  [Biography] 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
[Go to top] top

Posted by Magnum   Canada  (580 posts)  [Biography] 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.
[Go to top] 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.


19,415 views.

It is now over 60 days since the last post. This thread is closed.     [Refresh] Refresh page

Go to topic:           Search the forum


[Go to top] top

Quick links: MUSHclient. MUSHclient help. Forum shortcuts. Posting templates. Lua modules. Lua documentation.

Information and images on this site are licensed under the Creative Commons Attribution 3.0 Australia License unless stated otherwise.

[Home]


Written by Nick Gammon - 5K   profile for Nick Gammon on Stack Exchange, a network of free, community-driven Q&A sites   Marriage equality

Comments to: Gammon Software support
[RH click to get RSS URL] Forum RSS feed ( https://gammon.com.au/rss/forum.xml )

[Best viewed with any browser - 2K]    [Hosted at HostDash]