|
leirin Newbie
Joined: 14 Oct 2000 Posts: 9 Location: USA
|
Posted: Tue Dec 31, 2002 11:50 pm
JScript |
I'm trying to get the JScript to work, not because I have issues with zScript, I just want it to be more portable (not everyone uses ZMud). So I've written it in JScript, and my code works, in another client and when I embedded it into a webpage. But I can't for the life of me figure out how to work this in zmud.
I've tried to learn starting from the basics, so I did a search to see what I could come up with, which wasn't much. But for a starting point, I went with this:
#mss {sess.EchoStr("blah");} JScript
With various permutations with quotes and what not on both arguments. It gives errors every time, and I have not found a way to make this simple example to work.
If you can answer that, then try...
I want to have the code I've made available globally. So for instance, if I wrote some code like in an alias, as JScript
function testfunc() {
sess.EchoStr("test");
}
Then I could call it from another alias or the command line with something like:
#mss {testfunc()} "JScript"
or however this works, since that apparently isn't it.
Obviously the examples here are very simple, just to get me headed in the right way. The code I'm working with is more complicated, just so you know :)
Thanks!
-----
Leirin
leirin@mud.arctic.org |
|
|
|
Kjata GURU
Joined: 10 Oct 2000 Posts: 4379 Location: USA
|
Posted: Wed Jan 01, 2003 1:10 am |
EchoStr has a second argument that you have to specify. It is the color of the text to be written on the screen. Aside from that, I can get it to work with single quotes:
#MSS {sess.EchoStr('blah', 2);} "JScript"
You can also use #SS which seems to allow either double quotes or single quotes. Finally, to define functions and variables for later use, you can use the #SCRIPT command:
#SCRIPT {function testfunc() {sess.EchoStr('test', 2);}} "JScript"
Kjata |
|
|
|
leirin Newbie
Joined: 14 Oct 2000 Posts: 9 Location: USA
|
Posted: Wed Jan 01, 2003 1:24 am |
OK that worked, thanks a lot!
Now, is the location the #script command reads to/from, where I could subsequently edit it? Or is it just parsed and placed into memory? If the former things are easier, otherwise I believe I'll have to execute an alias with #script commands to read into memory the entire script before I use it. I'm guessing using #script is similar to defining with <script> in HTML.
Did that make any sense? Thanks a lot for your holiday help.
-----
Leirin
leirin@mud.arctic.org |
|
|
|
Kjata GURU
Joined: 10 Oct 2000 Posts: 4379 Location: USA
|
Posted: Wed Jan 01, 2003 4:50 am |
It's read into memory. Like you said, create an alias (you can even do this in atconnect) that sets everything up before the other scriting is performed.
Kjata |
|
|
|
|
|
|
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
|
|