|
hpacez Newbie
Joined: 08 Mar 2006 Posts: 6
|
Posted: Fri Mar 10, 2006 9:22 am
Scripting |
Hi everyone,
Another question regarding VBScripting: How do you transform data from the MUD so it can be used in a script, and vica versa from the scripts processing back to the command line to generate a response? For example, let's say I wanted to say "Hello World" to the MUD (as print or msgbox is not interpreted by the command line as input).
If I understand right the script has to feed it back to zMUD's scripting language and then enter it into the MUD? A technical example would be great, not really seeing it from the help files. |
|
|
|
Taz GURU
Joined: 28 Sep 2000 Posts: 1395 Location: United Kingdom
|
Posted: Fri Mar 10, 2006 4:02 pm |
Code: |
#VAR X {2}
#VAR X
#MSS
#MSS {x=@X:x=x+2}
#VAR X {%mss(x)}
#VAR X
|
The above does the following:
Code: |
1. Sets a zMUD variable X to 2.
2. Displays the zMUD variable X on the mud screen.
3. Clears any previous scripting malarky.
4. Sets a scripting variable x to be the contents of the zMUD variable X and then sets a scripting variable x to be itself plus 2.
5. Sets a zMUD variable X to be a scripting variable x.
6. Displays the zMUD variable X on the mud screen.
|
and you get the following:
Code: |
Variable: X 2
Variable: X 4
|
Ok so you would expect to be able to do something similar with text instead of a number, after all zMUD variables are only strings. Yet using the following:
Code: |
#VAR X {Hello}
#VAR X
#MSS
#MSS {x=@X:x=x&" World"}
#VAR X {%mss(x)}
#VAR X
|
all I ended up with was
Code: |
Variable: X Hello
Variable: X
|
so it seems that text gets passed over as nothing. |
|
_________________ Taz :) |
|
|
|
Zugg MASTER
Joined: 25 Sep 2000 Posts: 23379 Location: Colorado, USA
|
Posted: Mon Mar 13, 2006 5:58 pm |
The & in the script might be getting confused with the "database expansion" special character. Or, the @X in the #MSS command might need quotes around it. Remember that zMUD is doing straight string substitution, so your #MSS script really looks like this to VBScript:
x=Hello:x=x&" World"
and my guess is that without quotes around Hello VBScript probably aborts the script with an error. |
|
|
|
Taz GURU
Joined: 28 Sep 2000 Posts: 1395 Location: United Kingdom
|
Posted: Tue Mar 14, 2006 12:48 pm |
The above code generates no errors and generates the output as per the last code section.
How do you store quotes in a variable? |
|
_________________ Taz :) |
|
|
|
|
|