Interaction, Random timers, some other things.

Posted by Oberon on Mon 03 Sep 2001 10:26 PM — 2 posts, 14,952 views.

#0
Interaction- what I mean by this is that it would be nice if a timer could execute an alias, if a trigger could turn a timer/another trigger/etc on or off, and so on and so forth. (Maybe this has allready been implemented, I'm not sure. It's not in the help file I have, if it has.)

Random timers- it'd be nice if you could make a timer fire randomly, within a specified interval. For example, if you wanted to return the command "look" sometime between every 10 and 30 seconds, as opposed to exactly every 15 seconds.

Databases- if you had auto-updateable databases, that'd be nice too. It could work like this-
First, you'd have to define the database. This would be a typical database, with tables and fields and relations.

Second, you'd define a template that the data would be taken from. Let's say a whois from a MUD looks like this:
Joe
Race: human Sex: male Age: 22 Level: 5
Rp: 0 Kills: 898 Deaths: 7
Email:
Url:

You would define a template that looks like this:

*
Race: * Sex: * Age: * Level: *
Rp: * Kills: * Deaths: *
Email: *
Url: *

Or, for more control:

<name>
Race: <race> Sex: <male|female> Age: <age> Level: <level>

And so on. Then, when the client receives text that fits your template, it automatically updates your database accordingly. This way, you can keep a database of friends/players to keep an eye on, items, mobs, etc.
Australia Forum Administrator #1
Most of that is possible right now.

Take a look at this web page:


http://www.gammon.com.au/mushclient/functions.htm


A trigger, timer or alias can enable or disable triggers, timers or aliases using script functions such as:

  • EnableTrigger
  • EnableTimer
  • EnableAlias


You could make a timer fire randomly by making a "one-shot" timer that, when it fired, added another one using a random time interval (using a random function in the script).

As for databases with fields, relations and so on, there was a recent post about interacting with an ODBC database using JScript. You could also do that with the other scripting languages.

For instance, you could use MySQL database (which is free, and there is a version for Windows) as your database engine, MyODBC as its ODBC interface, and then add tables, data etc. using script calls.

Then with appropriate triggers you could do a MODIFY or INSERT on the database data to keep the data up-to-date.