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


Register forum user name Search FAQ

Gammon Forum

[Folder]  Entire forum
-> [Folder]  MUSHclient
. -> [Folder]  VBscript
. . -> [Subject]  wierd problem with constants.vbs

wierd problem with constants.vbs

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


Posted by Perrin   USA  (31 posts)  [Biography] bio
Date Tue 05 Feb 2008 01:27 AM (UTC)

Amended on Tue 05 Feb 2008 01:30 AM (UTC) by Perrin

Message
yesterday i was messing around with a trigger and started to receive this error message i didn't do anything to this file and can't figure out what happened

Script error
World: aardwolf
Execution of line 1 column 1
Immediate execution
Expected statement
Line in error: 
<?xml version="1.0" encoding="UTF-8"?>

heres the first few line of the file


<?xml version="1.0" encoding="UTF-8"?>

<!-- Constants For use in VB scripting -->

<!DOCTYPE script>
<script>
<!\[CDATA\[
option explicit

aardwolf player
[Go to top] top

Posted by Nick Gammon   Australia  (22,975 posts)  [Biography] bio   Forum Administrator
Date Reply #1 on Tue 05 Feb 2008 03:46 AM (UTC)
Message
Can you post the trigger you were messing with?

- Nick Gammon

www.gammon.com.au, www.mushclient.com
[Go to top] top

Posted by Perrin   USA  (31 posts)  [Biography] bio
Date Reply #2 on Tue 05 Feb 2008 03:49 PM (UTC)

Amended on Tue 05 Feb 2008 04:04 PM (UTC) by Perrin

Message
Its the trigger i posted in help with an alias/trigger

I switched my script file to a blank .vbs file
all my script functions seem to work but mushclient crashes when i try to use trace

do you know where i can get a new constants.vbs file your link is dead for me.

aardwolf player
[Go to top] top

Posted by Nick Gammon   Australia  (22,975 posts)  [Biography] bio   Forum Administrator
Date Reply #3 on Tue 05 Feb 2008 07:13 PM (UTC)

Amended on Tue 05 Feb 2008 07:25 PM (UTC) by Nick Gammon

Message
You haven't given me a heap of information here, however I am guessing that you have a plugin installed (which are the only things that use constants.vbs).

You also haven't said which version of MUSHclient you are using

First thing I would try is remove your plugins and see if the error goes away.

I suspect the problem is caused by using a "relative" path in your configuration for plugins - see Global Preferences -> Plugins -> Plugins Directory. A relative paths starts with a dot (like ".\worlds\plugins\")

I would hit that button and select the actual directory, changing it to an absolute directory (eg. "C:\Program Files\MUSHclient\worlds\plugins\").

- Nick Gammon

www.gammon.com.au, www.mushclient.com
[Go to top] top

Posted by Perrin   USA  (31 posts)  [Biography] bio
Date Reply #4 on Fri 08 Feb 2008 11:06 PM (UTC)

Amended on Fri 08 Feb 2008 11:09 PM (UTC) by Perrin

Message
Ok my dir was absolute and i uninstalled everything making backups of my aliases/triggers/plugins/variables
reinstalled mushclient and recreated my world
when i enabled scripting and switched from lua to vbscript
and targeted the new constants.vbs i received this message

Error number: -2146827264
Event:        Execution of line 1 column 1
Description:  Expected statement

Line in error: 

<?xml version="1.0" encoding="UTF-8"?>
Called by:    Immediate execution



had just created the worldfile it is pretty bare
has no aliases,plugins,etc.

aardwolf player
[Go to top] top

Posted by Nick Gammon   Australia  (22,975 posts)  [Biography] bio   Forum Administrator
Date Reply #5 on Fri 08 Feb 2008 11:59 PM (UTC)
Message
Ah OK I see what you are doing. That file constants.vbs is not supposed to be directly used as your script file. If you make a plugin it is included as part of the plugin, to give you various helpful names inside your scripts.

For example, take this line:


const eTimerAlreadyExists = 30018 ' Attempt to add a timer that already exists


Now after doing an AddTimer you might get back an error code. You could either say:


if error = 30018 then
  '  could not add timer
endif


Or, if you used the constants file, you could say:


if error = eTimerAlreadyExists then
  '  could not add timer
endif


The second one is slightly better documentation basically.

Unless you want to use all the names in constants.vbs I would ignore it, and simply make a blank script file (or no script file at all, and just do "send to script").

For more details about that see:

http://mushclient.com/scripting

However if you want to use the constants inside a script file, just omit the XML stuff at the start and the end, like this:


<?xml version="1.0" encoding="UTF-8"?>

<!-- Constants For use in VB scripting -->

<!DOCTYPE script>
<script>
<![CDATA[


.......... keep the rest of the file up to the last 2 lines ........


]]>            
 </script>


If you copy and paste the stuff excluding what I have in bold above, then that is ordinary VBscript, and you could paste it into the start of your new, empty, script file.


- Nick Gammon

www.gammon.com.au, www.mushclient.com
[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.


15,985 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]