Register to post in forums, or Log in to your existing account
 

Play RetroMUD
Post new topic  Reply to topic     Home » Forums » CMUD General Discussion
chamenas
Wizard


Joined: 26 Mar 2008
Posts: 1547

PostPosted: 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.
_________________
Listen to my Guitar - If you like it, listen to more
Reply with quote
Moo
Apprentice


Joined: 10 Apr 2009
Posts: 145

PostPosted: Fri Oct 01, 2010 10:49 am   
 
Why not just create an alias in the package editor, and set the language to VBScript?
Reply with quote
chamenas
Wizard


Joined: 26 Mar 2008
Posts: 1547

PostPosted: 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.
_________________
Listen to my Guitar - If you like it, listen to more
Reply with quote
Taz
GURU


Joined: 28 Sep 2000
Posts: 1395
Location: United Kingdom

PostPosted: Fri Oct 01, 2010 6:52 pm   
 
Don't put it in a function put it in an alias like Moo said.
_________________
Taz :)
Reply with quote
chamenas
Wizard


Joined: 26 Mar 2008
Posts: 1547

PostPosted: 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.
_________________
Listen to my Guitar - If you like it, listen to more
Reply with quote
Taz
GURU


Joined: 28 Sep 2000
Posts: 1395
Location: United Kingdom

PostPosted: Sat Oct 02, 2010 2:36 pm   
 
You definitely changed the script language to vbscript?
_________________
Taz :)
Reply with quote
chamenas
Wizard


Joined: 26 Mar 2008
Posts: 1547

PostPosted: 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=" &amp; strMessage} "twitter_toasts" </value>
</alias>
_________________
Listen to my Guitar - If you like it, listen to more
Reply with quote
chamenas
Wizard


Joined: 26 Mar 2008
Posts: 1547

PostPosted: Sat Oct 02, 2010 10:56 pm   
 
What else might cause this issue?
_________________
Listen to my Guitar - If you like it, listen to more
Reply with quote
Moo
Apprentice


Joined: 10 Apr 2009
Posts: 145

PostPosted: Mon Oct 04, 2010 10:37 am   
 
Code:
  objXML.Send "status=" &amp; 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.
Reply with quote
chamenas
Wizard


Joined: 26 Mar 2008
Posts: 1547

PostPosted: 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.
_________________
Listen to my Guitar - If you like it, listen to more
Reply with quote
chamenas
Wizard


Joined: 26 Mar 2008
Posts: 1547

PostPosted: 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)?
_________________
Listen to my Guitar - If you like it, listen to more
Reply with quote
Display posts from previous:   
Post new topic   Reply to topic     Home » Forums » CMUD General Discussion All times are GMT
Page 1 of 1

 
Jump to:  
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

© 2009 Zugg Software. Hosted by Wolfpaw.net