Ceren2005-07-17 20:37:59
I'm a complete scripting newbie, and I was trying to get some basic stuff to work with Python on Mushclient. I'm trying to use Ethelon's system as an example, but that's not working very well considering its in VBscript.
So I type one simple thing:
world.Note "bla bla bla"
...but Mushclient won't accept the script, giving me the error message "Class not Registered". Funny thing is, there's not a single class in the entire one line script!
So is this a problem with something external, Mushclient, or the code itself? Any help much appreciated.
So I type one simple thing:
world.Note "bla bla bla"
...but Mushclient won't accept the script, giving me the error message "Class not Registered". Funny thing is, there's not a single class in the entire one line script!
So is this a problem with something external, Mushclient, or the code itself? Any help much appreciated.
Unknown2005-07-17 21:04:38
Python has different syntax from VBscript, which is what you will want to learn first. I recommend going through the MUSHclient forums, particularly the Python scripting forum, and also finding a good Python tutorial online. Nick's documentation has examples of using each scripting function (the ones he provides in MUSHclient, that is) in each language, so that's a good place to start.
http://www.gammon.com.au/scripts/doc.php?function=Note
Now, the error message you saw was a result of not having Python installed. Before you go downloading Python, however, know that they are not all compatible with MUSHclient. You'll need one that supports the Windows Scripting Host (WSH) engine. I recommend ActivePython, from ActiveState. Good luck, and have fun!
http://www.gammon.com.au/scripts/doc.php?function=Note
Now, the error message you saw was a result of not having Python installed. Before you go downloading Python, however, know that they are not all compatible with MUSHclient. You'll need one that supports the Windows Scripting Host (WSH) engine. I recommend ActivePython, from ActiveState. Good luck, and have fun!
Ceren2005-07-17 21:33:02
I'll try that. Thank you!
tarik2005-07-17 21:42:34
At the risk of stating the bloody obvious, if you have an example system in VB script, why don't you try using that as your scripting language instead of Python?
Ceren2005-07-17 21:56:31
Because I've seen a lot of opinions on these forums that rate Python higher than VBscript, and I can't say I'm a testament to logic either
tarik2005-07-17 22:08:53
QUOTE(ceren @ Jul 17 2005, 09:56 PM)
Because I've seen a lot of opinions on these forums that rate Python higher than VBscript, and I can't say I'm a testament to logic either
153491
Well yeah, if you're looking for a general purpose scripting or even programming language then Python would probably be my preference too. But for scripting in Mushclient it doesn't really matter, they can both get the job done. I would also recommend VB script because it was the first to be supported for Mushclient and as such there are far more examples and resources available on Nick's website.
If you want to be more cutting edge then you could go for Lua. Or maybe if you really want to be the envy of your peers then lobby nick to include support for Boo or some other CLR language. Alternatively you could try the avant garde approach and write your entire system in Fortran and be damned.
Ceren2005-07-17 23:12:30
I'm sure those are all good choices... I'm just too lazy to start from scratch with a new langauge
Ceren2005-07-17 23:45:38
Another question.. in VBscript the trigger subroutine is simply sub, what is it in Python? I tried def blocks and that didn't work
Unknown2005-07-17 23:50:09
MUSHclient has python scripting?.... I'm tempted to give it a whirl maybe....
tarik2005-07-18 01:12:40
QUOTE(ceren)
Another question.. in VBscript the trigger subroutine is simply sub, what is it in Python? I tried def blocks and that didn't work
Well def should do the trick... it may be something simple like incorrect arguments or scripting not enabled? Also have you looked at the exampscript.py file that comes with Mushclient?
QUOTE(Nine Breaker)
MUSHclient has python scripting?.... I'm tempted to give it a whirl maybe....
Yep, as well as VBScript, ######, PerlScript, PHPScript, Tcl and Lua.
Ok, I guess I'll refer to it as JScript then...
Daganev2005-07-18 01:42:25
As an artsit who can't really program well, and has taken many classes in java...
I think its best to stick to a language that is the easiest for you to use for the project you are doing, and don't worry about learning new languages for other reasons.
For example, in Flash, you want to use action script, but in Adobe you need to use JScript, but Jscrip sucks if you need a java applet in that webpage.
And Zmud is completely different, and has its own syntax that is easy to use because there are so many damn forum posts on the subject.
So use whats easiest for you to learn based on the help files available to you.
I think its best to stick to a language that is the easiest for you to use for the project you are doing, and don't worry about learning new languages for other reasons.
For example, in Flash, you want to use action script, but in Adobe you need to use JScript, but Jscrip sucks if you need a java applet in that webpage.
And Zmud is completely different, and has its own syntax that is easy to use because there are so many damn forum posts on the subject.
So use whats easiest for you to learn based on the help files available to you.
Unknown2005-07-18 10:54:35
If you're having trouble with Python functions, make sure you're using tabs to properly indent all your blocks of code. That's one reason I switched to Lua, actually.
Ceren2005-07-18 21:17:16
I found the problem, I wasn't using 'return' at the end of my blocks. Kind of odd considering you don't have to do that when using Python outside of Mushclient...
Ceren2005-07-18 21:35:05
New problem though (Mushclient is plotting against me!), it gives me an error message that I need three arguments, so I typed:
def testfunc(a, b, c)
world.note("I hope this works")
return
three arguments there, right? Oddly enough, in the error message it tells me the function is "testfunc()".. Hold it right there, that's not what I typed! I go back to check the script and it's just how I left it: testfunc(a, b, c)
Help?
def testfunc(a, b, c)
world.note("I hope this works")
return
three arguments there, right? Oddly enough, in the error message it tells me the function is "testfunc()".. Hold it right there, that's not what I typed! I go back to check the script and it's just how I left it: testfunc(a, b, c)
Help?
Unknown2005-07-19 01:36:17
Did you use the indentations this time? What did the error message say exactly? It would really help if you posted the exact message, which could be "invalid number of arguments" or "no such method: world.note" or something totally different.
When you put the call to a script function in the 'Script' field, you will need these three arguments, as detailed in the MUSHclient help files. However, those three arguments don't always make sense and you might want to do other script things in your aliases or triggers, right? In that case, you have the option of using 'Send To Script' and putting your script code (sans def funcname(blah) in the command for your alias/trigger. Then, you can use any language constructs and parameters you like.
Also, when you edited your script, did you reload your script file? (Just trying to cover all bases, not knowing the exact error yet.)
When you put the call to a script function in the 'Script' field, you will need these three arguments, as detailed in the MUSHclient help files. However, those three arguments don't always make sense and you might want to do other script things in your aliases or triggers, right? In that case, you have the option of using 'Send To Script' and putting your script code (sans def funcname(blah) in the command for your alias/trigger. Then, you can use any language constructs and parameters you like.
Also, when you edited your script, did you reload your script file? (Just trying to cover all bases, not knowing the exact error yet.)
Ceren2005-07-19 02:02:18
I always used the indents, about the one thing I DID do right
And I can't post the error message because I'm not getting it anymore. I just reloaded Mushclient after reading your post and without changing anything... it just worked, so no problems here!
And I'll keep that send to script tip in mind, Thanks!
And I can't post the error message because I'm not getting it anymore. I just reloaded Mushclient after reading your post and without changing anything... it just worked, so no problems here!
And I'll keep that send to script tip in mind, Thanks!
Alger2005-07-19 23:50:52
go ceren! Nice to see people writing their own systems.
Unknown2005-07-20 00:02:03
Mmm, nothing better than your own system that actually works.
Long path before me though...
Long path before me though...
Ceren2005-07-21 03:44:38
QUOTE(Alger @ Jul 19 2005, 05:50 PM)
go ceren! Nice to see people writing their own systems.
154815
Trying anyway