Register forum user name Search FAQ

Gammon Forum

Notice: Any messages purporting to come from this site telling you that your password has expired, or that you need to verify your details, confirm your email, resolve issues, making threats, or asking for money, are spam. We do not email users with any such messages. If you have lost your password you can obtain a new one by using the password reset link.
 Entire forum ➜ MUSHclient ➜ General ➜ Languages

Languages

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


Pages: 1 2  

Posted by Beale   (35 posts)  Bio
Date Mon 08 Nov 2004 09:03 PM (UTC)
Message
Just out of curiosity and for recommendation's sake, what languages do the collective 'you' use to script in MUSHClient, and why?

I personally use both VBScript and Python, VBScript to export for other people as plugins, and Python to experiment with for myself.
Top

Posted by Nick Gammon   Australia  (23,120 posts)  Bio   Forum Administrator
Date Reply #1 on Tue 09 Nov 2004 03:04 AM (UTC)
Message
Personally I usually use VBscript. It is not that I particularly *like* VB, however it does have some things to recommend it:


  • It is generally available by default, as VBscript (and probably JScript as well) are normally installed as part of Internet Explorer. If not, it is readly available as a download from Microsoft. If I were to do plugins or examples in (say) Python or Perl, then the end-user may not have that installed.

  • It has a fairly simple interface to COM objects, and thus to the MUSHclient "world" interface. MUSHclient calls that return arrays look a bit clumsy in JScript and Perlscript.

    If you compare the code in:

    http://www.gammon.com.au/scripts/doc.php?function=GetVariableList

    JScript needs the extra step of "toArray()" and Perlscript needs "foreach $item (Win32::OLE::in ($world->GetVariableList))".

    Admittedly Python looks pretty neat.

  • For me, since VBscript was the first script language I used with MUSHclient I tend to know its features better than other languages.




- Nick Gammon

www.gammon.com.au, www.mushclient.com
Top

Posted by Shadowfyr   USA  (1,788 posts)  Bio
Date Reply #2 on Tue 09 Nov 2004 04:39 AM (UTC)
Message
I use VBScript myself. It is something I am familiar with. Though I would prefer something with more Python like capabilities, Python has its own flaws, not the least being forcing you to use specific indentation as part of the syntax. It also tends to be slightly more obscure in terms of how you link things in, etc. (though with VB it is more a case of you can't anyway.) I would love to see something in between the two, but...
Top

Posted by Somegirl   (33 posts)  Bio
Date Reply #3 on Tue 09 Nov 2004 06:55 AM (UTC)
Message
I started out using VB script mostly because it looked familiar to me. I grew up using computers like the C64 and Basic is an old old language now. It's pretty easy to learn for anyone who can map something out in a step-by-step, logical fashion. Also, as Nick said, it's widely available and probably already installed on your computer.

I recently started using Python because I found VB script lacking some things that I needed to write more complicated scripts for MUDs like Achaea. After I created my first list in Python, I was hooked.

It's a pretty easy language to learn. The indentation is odd at first, but as you start to learn the language, you'll see why it's nice. I think it's a great feature.

The obscure parts, if you ask me, are the documentation. Don't misunderstand, it is well documented. It was just hard to make the transition from VB script. I should have just started out in Python.

Since you're already using Python, I would say, just keep at it. It's much more powerful. People who want to use your plugins can use them in Python.

It doesn't appear that there are more than a couple of us using Python regularly, so I secretly hope everyone reads this and then looks at something like diveintopython.org so that section of the forum takes off and then Nick decides to really try it out. (I'm telling you, Nick. Don't play with it or you will never use VB script again.)
Top

Posted by Shadowfyr   USA  (1,788 posts)  Bio
Date Reply #4 on Tue 09 Nov 2004 04:15 PM (UTC)
Message
Well, the problem people have with the indention isn't that it is 'bad', but just that it breaks language standards, which usually ignore white space, so you can use any indentation you want. When they force it on you... The only other language requiring that was some ancient one used with card punch machines, since the machine needed to be able to tell commands to the card punch appart from the program code. There is no excuses for such a anachronism in a modern language imho. I agree with the documentation issue though.
Top

Posted by Poromenos   Greece  (1,037 posts)  Bio
Date Reply #5 on Tue 09 Nov 2004 06:05 PM (UTC)
Message
I agree 100% with the indentation being forced in Python. I hate code that isn't indented, and Python forces you to write great code. The only reason I don't write in Python is that most people don't have it installed...

Vidi, Vici, Veni.
http://porocrom.poromenos.org/ Read it!
Top

Posted by David Haley   USA  (3,881 posts)  Bio
Date Reply #6 on Tue 09 Nov 2004 08:29 PM (UTC)
Message
The only reason to not write with indentation is if you're writing in bad style, so it's not much of a problem to enforce it. It's hardly an 'anachronism'.

And in fact not all modern languages ignore whitespace - for instance, newlines are often used as statement terminators and to span a command over multiple lines you need to use escape characters e.g. \ at the end of the line.

David Haley aka Ksilyan
Head Programmer,
Legends of the Darkstone

http://david.the-haleys.org
Top

Posted by Somegirl   (33 posts)  Bio
Date Reply #7 on Tue 09 Nov 2004 09:07 PM (UTC)
Message
I sure is nice to not have to look and your subroutine and think:
"Okay, there's.....1, 2, 3 'end ifs' and then an 'end select' and another 'end if' and why doesn't it work?? arg! Oh wait, I forgot the 'end sub'. Heh.
Top

Posted by David Haley   USA  (3,881 posts)  Bio
Date Reply #8 on Tue 09 Nov 2004 10:35 PM (UTC)

Amended on Tue 09 Nov 2004 10:37 PM (UTC) by David Haley

Message
The thing is that even C or whatever programmers simply should not be writing code without using proper indentation one way or another anyways.

Now different people indent in different ways, e.g. my style tends to be:

void foo()
{
  if ( something )
  {
    // do some stuff
  }
}

whereas other people write like so:
void foo()
  {
  if ( something )
    {
    // do some stuff
    }
  }


Either way the structure is clear. The point is that a programmer who is not using indents is just as guilty of bad style as an author who writes text without paragraphs.

The only advantage, as far as I can see, of not enforcing indents is that sometimes there are cases where it's ok to use 'shorthand', e.g.
if ( a < 1 ) b += 6;

but typically, this kind of code is discouraged and should only be used when both the condition and the action are pretty short.

David Haley aka Ksilyan
Head Programmer,
Legends of the Darkstone

http://david.the-haleys.org
Top

Posted by Shadowfyr   USA  (1,788 posts)  Bio
Date Reply #9 on Tue 09 Nov 2004 11:46 PM (UTC)
Message
I agree with indention, I just want it to be 'my' indention, not something forced on me by the language.
Top

Posted by David Haley   USA  (3,881 posts)  Bio
Date Reply #10 on Wed 10 Nov 2004 02:54 AM (UTC)
Message
Well, ok, then just say so and don't start blasting it with 'anachronism' etc. :-)

David Haley aka Ksilyan
Head Programmer,
Legends of the Darkstone

http://david.the-haleys.org
Top

Posted by Flannel   USA  (1,230 posts)  Bio
Date Reply #11 on Wed 10 Nov 2004 03:27 AM (UTC)
Message
Should not.
Can not.
Different things.

Anyway, did we all wake up on the wrong side of the keyboard today or something?

Theyre languages, they each have their strengths and shortcomings, which is why MC has a few for us to choose from.

Lets steer this back to a constructive discussion, to help new people figure out what language they might want to use.

I think the obvious 'newbie' script language is VBscript, since a lot of people grew up with BASIC in some form or another, and even more have been introduced it with a lot of other things.
It's reasonably forgiving with syntax. The only drawback is Variants, and the problems they have.
You can 'easily' incorperate COM objects (since its designed to work well with Windows), and its on most (if not all) windows boxes.

~Flannel

Messiah of Rose
Eternity's Trials.

Clones are people two.
Top

Posted by Shadowfyr   USA  (1,788 posts)  Bio
Date Reply #12 on Wed 10 Nov 2004 04:32 AM (UTC)
Message
Yes. VB defintely has a major problem with variants. The problem is not so much that it uses them, but that it doesn't allow for more strict definitions. All COM programs use variants to talk to each other. Most languages convert to and from them to the more specific types at either end. MS decided to over simplify matters by making VB 'only' use them and nothing else. Usually this is not a problem, but some times it causes real annoyances.
Top

Posted by David Haley   USA  (3,881 posts)  Bio
Date Reply #13 on Wed 10 Nov 2004 06:55 AM (UTC)
Message
Huh? VB definitely has the ability for a strict type system. 'Dim I as Integer' means that I is an integer, and if you try to assign a string to it, it will either give you a type mismatch or it will try to convert. More likely, a type mismatch. If you declare something as a string, and try to assign an int to it, it'll convert, I think - it definitely will if you use the concatenate operator.

There's no way to 'have your cake and eat it do'. Variants are a very powerful system - Perl uses them as does PHP. If you're communicating arbitrary information across application borders, you need to have *some* way of representing an arbitrary type. C uses void*, which is basically a variant in the sense that you cast it.

But VB most certainly has type casting so that you can convert variants to specific types. I believe the function in vb6 is called CInt to convert to ints, CString to convert to string, etc. The thing is that most of the time these conversions are done implicitly, but you can use them to do explicit conversions.

David Haley aka Ksilyan
Head Programmer,
Legends of the Darkstone

http://david.the-haleys.org
Top

Posted by Flannel   USA  (1,230 posts)  Bio
Date Reply #14 on Wed 10 Nov 2004 08:08 AM (UTC)
Message
He's talking about VBScript.
And we're talking about ALL the issues with using getvariable and adding stuff to it, and getting funky results.
Or trying and compare things with conditionals.

And yes, VBScript does have casting, it's probably the single most thing we have people 'fix'. Well, that and loops in code.

But thats just it. We have to fix it. Even though you JUST set something as a number, and now youre trying to do something with it, the engine MIGHT think that it's a string and then choose one of a few ways to deal with the 'type mismatch'.

~Flannel

Messiah of Rose
Eternity's Trials.

Clones are people two.
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.


64,849 views.

This is page 1, subject is 2 pages long: 1 2  [Next page]

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

Go to topic:           Search the forum


[Go to top] top

Information and images on this site are licensed under the Creative Commons Attribution 3.0 Australia License unless stated otherwise.