 |
chamenas Wizard

Joined: 26 Mar 2008 Posts: 1547
|
Posted: Fri Oct 01, 2010 8:53 am
#SCRIPT command question |
The syntax in the helpfiles shows a script occurring with EOFs being represented by colons, aka:
Code: |
#SCRIPT {x=0:sub test:x=x+1:msgbox x:end sub}
|
Now, it may just be me, but this seems to be a dreadful way of functioning multi-line scripts such as:
Code: |
#SS "VBScript" strUserName = "YOUR_TWITTER_NAME"
strSuperTweetPassword = "YOUR_SUPERTWEET_PWORD"
strMessage = Replace("%1", "'", "`") ' replace single quote with back tick so it'll tweet
Set objXML = CreateObject("Msxml2.XMLHTTP")
objXML.Open "POST", _
"http://api.supertweet.net/1/statuses/update.xml", _
False, _
strUserName, _
strSuperTweetPassword
objXML.setRequestHeader _
"Content-Type", _
"application/x-www-form-urlencoded "
objXML.Send "status=" & strMessage} "twitter_toasts"
|
The above is a brief bit of VB used for a script in zMUD which allows toast messages to be tweeted. I'd like to expand upon the concept for CMUD, but it would really help if I could use a multi-line script like the above was done in zMUD. Is it possible? I get all sorts of weird errors when I try to extend it to multiple lines, even if the script is encapsulated in brackets. |
|
|
 |
Moo Apprentice
Joined: 10 Apr 2009 Posts: 145
|
Posted: Fri Oct 01, 2010 10:49 am |
Why not just create an alias in the package editor, and set the language to VBScript?
|
|
|
 |
chamenas Wizard

Joined: 26 Mar 2008 Posts: 1547
|
Posted: Fri Oct 01, 2010 10:56 am |
Put it in a function, but still getting an "Illegal Token" error for
Code: |
Set objXML = CreateObject("Msxml2.XMLHTTP")
|
In my experience, Illegal token errors are usually due to formatting issues. |
|
|
 |
Taz GURU
Joined: 28 Sep 2000 Posts: 1395 Location: United Kingdom
|
Posted: Fri Oct 01, 2010 6:52 pm |
Don't put it in a function put it in an alias like Moo said.
|
|
_________________ Taz :) |
|
|
 |
chamenas Wizard

Joined: 26 Mar 2008 Posts: 1547
|
Posted: Fri Oct 01, 2010 9:26 pm |
Still gives an Illegal Token error, either way. It should be noted that it's formatted exactly like this in zMUD and works just fine, so the suspicion is something about CMUD doesn't like this specific formatting.
|
|
|
 |
Taz GURU
Joined: 28 Sep 2000 Posts: 1395 Location: United Kingdom
|
Posted: Sat Oct 02, 2010 2:36 pm |
You definitely changed the script language to vbscript?
|
|
_________________ Taz :) |
|
|
 |
chamenas Wizard

Joined: 26 Mar 2008 Posts: 1547
|
Posted: Sat Oct 02, 2010 3:44 pm |
100% certain:
Code: |
<alias name="CallTweet" language="VBScript" id="1662">
<value>strUserName = "Sample"
strSuperTweetPassword = "test"
strMessage = "Another Test"
Set objXML = CreateObject("Msxml2.XMLHTTP")
objXML.Open "POST", _
"http://api.supertweet.net/1/statuses/update.xml", _
False, _
strUserName, _
strSuperTweetPassword
objXML.setRequestHeader _
"Content-Type", _
"application/x-www-form-urlencoded "
objXML.Send "status=" & strMessage} "twitter_toasts" </value>
</alias>
|
|
|
|
 |
chamenas Wizard

Joined: 26 Mar 2008 Posts: 1547
|
Posted: Sat Oct 02, 2010 10:56 pm |
What else might cause this issue?
|
|
|
 |
Moo Apprentice
Joined: 10 Apr 2009 Posts: 145
|
Posted: Mon Oct 04, 2010 10:37 am |
Code: |
objXML.Send "status=" & strMessage} "twitter_toasts" </value> |
This is the offending line, which is what the CMUD error box shows (here, at least)...
I replaced the "}" with " &" and it compiled (and seemed to do something). I'm guessing that twitter_toasts was intended as an identifier though. |
|
|
 |
chamenas Wizard

Joined: 26 Mar 2008 Posts: 1547
|
Posted: Mon Oct 04, 2010 2:57 pm |
It breaks for me on:
Code: |
Set objXML = CreateObject("Msxml2.XMLHTTP")
|
this line, acting as if my equal sign is an illegal token. If I take that out, then suddenly the open parentheses becomes the offending token. |
|
|
 |
chamenas Wizard

Joined: 26 Mar 2008 Posts: 1547
|
Posted: Tue Oct 05, 2010 4:20 pm |
Perhaps if there's no one else who can suggest why a VB script which has been shown to work just fine (works in zMUD) doesn't work in CMUD then maybe I should report it as a bug in the BETA forums (since I'm using the BETA)?
|
|
|
 |
|
|