 |
Mordenkeinen Beginner
Joined: 19 Feb 2004 Posts: 10 Location: USA
|
Posted: Sun Mar 14, 2004 9:19 pm
Is it possible to ... ? |
Ok, let's say I have written a script, and am now wanting to distribute that script to others. Is there a way for zMUD to detect when a person imports that script into their settings, and to be able to trigger off of it?
What I would like to do is have it where when someone imports my script, it echos to the main window a brief help listing of commands. Things like what to type to do the initial setup of the script, what commands are available for the script, and who to contact about bugs/updates. Most importantly, I would like to be able to have it upon import run the configuration alias I have so that it configures the script for the user. Is this possible or do I need to make a feature request?
Thanks in advance! |
|
|
|
 |
Pega Magician
Joined: 08 Jan 2001 Posts: 341 Location: Singapore
|
Posted: Mon Mar 15, 2004 3:11 am |
You can do that and much more!
Remember, what you have is a script.
Importing a script is actually parsing it into memory.
Try importing an ASCII file with, '#show {Hello, world.}' as its contents.
Aside from the usual installation of triggers, variables, functions, status lines, buttons etc.
You can instantly display messages, ask questions with yes/no or multiple option prompts, display images, play music, load up webpages, the possibilities are endless.  |
|
|
|
 |
Mordenkeinen Beginner
Joined: 19 Feb 2004 Posts: 10 Location: USA
|
Posted: Mon Mar 15, 2004 3:52 am |
Yes, but the method of implementation eludes me in this. How can I check that the script was imported? Are there any functions or methods that are triggered/set when a script is imported that I can check or have a trigger to catch it so that I can have the script run it's initialization routines?
Yes, I understand the concept of using '#show {Hello, world.}' and then having a trigger that gags that from displaying, and the via an alias runs the initialization routines, but how would the script know when to use the '#show' command?
Thanks again! |
|
|
|
 |
Pega Magician
Joined: 08 Jan 2001 Posts: 341 Location: Singapore
|
Posted: Mon Mar 15, 2004 4:03 am |
You do _not_ have to gag stuff or create aliases.
Simply place your initialization routines directly in the script file.
It is a script!
If you want a routine to run, place it in the sequence you want it to work, directly in your script file.
Script it! This is _not_ a piece of source code for preprocessing+compilation+linking.
It is executed like an interpreter language. I guess you have not touched BASIC.
Get it?  |
|
|
|
 |
Pega Magician
Joined: 08 Jan 2001 Posts: 341 Location: Singapore
|
Posted: Mon Mar 15, 2004 4:05 am |
What i am trying to say is that the script runs immediately when you import it.
|
|
|
|
 |
Pega Magician
Joined: 08 Jan 2001 Posts: 341 Location: Singapore
|
Posted: Mon Mar 15, 2004 4:21 am |
Most zMUD commands when executed do not save in your settings file. Commands like #SHOW,#SAY,#MENU,#DBPUT,etc. are immediately executed on your command-line, or when importing or reading a script file.
Exceptions are #FUNC,#VAR,#ALARM,#TRIGGER,#ALIAS,#SUB,#UNVAR,#T+,etc. |
|
|
|
 |
Mordenkeinen Beginner
Joined: 19 Feb 2004 Posts: 10 Location: USA
|
Posted: Mon Mar 15, 2004 4:35 am |
I understand that... but barring opening the script in textpad and just adding in a randomly placed '#show' and then a trigger that gets fired when that '#show' is activated, I was hoping for a way of doing it within the editor. Having a method for a developer to use for initialization upon script import would be extremely useful... something along the lines of '#ONIMPORT {commands}'
As for not having touched BASIC, it's been almost 20 years since I played with BASIC. I'm currently a CS student majoring in Windows programming, with skills ranging from BASIC to Delphi to C/C++/C# to a few other languages. I am very familiar with the differences between compiled source code and an interpreted language.
But with the tools provided within zMUD, there isn't a way to just 'toss' a command such as '#show', without having to make a trigger, alias, button, or macro in order to execute the '#show' command. And then it leaves the fact that everytime the script is loaded into memory, that '#show' command, if just tossed in as you suggest, would fire, causing me to use more resources by having to set a variable and then checking that variable every time in order to stop it from executing the command.
Will the '#show' command fire evertime the settings are loaded into memory?
The limitations of the scripting engine deny me that ability as it stands currently without using textpad to modify the script. No offense intended Zugg, zMUD is the most powerful client I have ever used, and I wouldn't switch clients for all the money in the world... and to expect a programmer to think of every minute detail when it comes to building a scriptable environment for their software is ludacris. Maybe a future release of zMUD will include the ability to have commands executed when the script is loaded/imported. Keep up the good work Zugg!  |
|
|
|
 |
Pega Magician
Joined: 08 Jan 2001 Posts: 341 Location: Singapore
|
Posted: Mon Mar 15, 2004 4:53 am |
Let us just say that importing a script file is just like entering the entire script in your command-line, except it does not affect the #ONINPUT or command-line history. Get it?
Which means that if you put a #show {something} in your script file, it will not appear in your settings file in memory. It does not save. It would not exist after execution. As I said, some commands do not save stuff in your settings.
On the other hand, #ACTION/#TRIGGER, #FUNC/#VAR, etc. all place an image of itself in your settings file, and when auto-saved, it loads up every time.
I do not know of an easy way to for zMUD to display a message in your mud every time you open a character window or when settings are loaded in memory. |
|
|
|
 |
Mordenkeinen Beginner
Joined: 19 Feb 2004 Posts: 10 Location: USA
|
Posted: Mon Mar 15, 2004 5:03 am |
Ah, ok, I see now... thank you! 
|
|
|
|
 |
|
|
|
|
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
|
|