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


Register forum user name Search FAQ

Gammon Forum

[Folder]  Entire forum
-> [Folder]  MUSHclient
. -> [Folder]  Suggestions
. . -> [Subject]  io language - and Ruby

io language - and Ruby

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


Pages: 1 2  

Posted by Karagy   (1 post)  [Biography] bio
Date Mon 22 May 2006 05:34 AM (UTC)
Message
Hi Nick.
What you mean about subj?
see
http://www.iolanguage.com/
[Go to top] top

Posted by David Haley   USA  (3,881 posts)  [Biography] bio
Date Reply #1 on Mon 22 May 2006 05:42 AM (UTC)
Message
I'm not sure I understand your post. Are you suggesting that Nick include support for scripting in this 'Io' language?

David Haley aka Ksilyan
Head Programmer,
Legends of the Darkstone

http://david.the-haleys.org
[Go to top] top

Posted by Nick Gammon   Australia  (22,982 posts)  [Biography] bio   Forum Administrator
Date Reply #2 on Mon 22 May 2006 06:49 AM (UTC)
Message
I have moved this thread into the "suggestions" part of the forum, as I couldn't see what it had to do with Lua.

I checked out that site, I gather Io is another scripting language (inspired in part by Lua it says).

Assuming you are asking for support for it in MUSHclient, as far as I can see from their site, there is no well-documented method of incorporating it into C programs (unlike the Lua documentation which is very good in that respect).

Unless they release an interface using the Microsoft Scripting Interface (like VBscript, Jscript, Pythonscript and so on) I can't see it being practical to incorporate it into MUSHclient.

- Nick Gammon

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

Posted by Nobody   (38 posts)  [Biography] bio
Date Reply #3 on Sun 28 May 2006 06:22 AM (UTC)
Message
If the ActiveScripting Interface is all you need, then perhaps you should also consider using Ruby. Ruby is my (current) favourite for programming in general, and I use it on another client for my mud scripts.
[Go to top] top

Posted by Nick Gammon   Australia  (22,982 posts)  [Biography] bio   Forum Administrator
Date Reply #4 on Sun 28 May 2006 07:00 AM (UTC)
Message
Can you give me the link to the Ruby script engine please?

- Nick Gammon

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

Posted by Jestre   (13 posts)  [Biography] bio
Date Reply #5 on Mon 29 May 2006 02:36 AM (UTC)
Message
Windows installer for ruby:

http://rubyinstaller.rubyforge.org/wiki/wiki.pl

And the normal website:

http://www.ruby-lang.org/en/
[Go to top] top

Posted by David Haley   USA  (3,881 posts)  [Biography] bio
Date Reply #6 on Mon 29 May 2006 04:41 AM (UTC)
Message
I don't think those are what Nick wants; what I think he wants is the ActiveScript binding, not the general language:

http://raa.ruby-lang.org/project/asr/

David Haley aka Ksilyan
Head Programmer,
Legends of the Darkstone

http://david.the-haleys.org
[Go to top] top

Posted by Nobody   (38 posts)  [Biography] bio
Date Reply #7 on Mon 29 May 2006 07:21 AM (UTC)
Message
I know it's bad form to preach on a forum, but I have to say, if you're learning Object Orientated programming and are struggling, Ruby is a great language to help you. It's strongly object-orientated, it's wonderfully simple to both learn and use, and you will learn a great deal about classes and OO programming (and algorithms). It uses inheritance and 'ancestry' in a simple yet powerful way and (IMHO) makes it very easy to understand complex concepts in OO programming.

End bad form.
[Go to top] top

Posted by Nick Gammon   Australia  (22,982 posts)  [Biography] bio   Forum Administrator
Date Reply #8 on Mon 29 May 2006 08:14 AM (UTC)
Message
OK, I'll take a look at seeing if it works with MUSHclient.

I have had previous experiences where the Active Script implementation doesn't work properly, but we'll see.

I note from the examples at their web site that it looks remarkably similar in some ways to Lua (in function declarations for example).

- Nick Gammon

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

Posted by Ked   Russia  (524 posts)  [Biography] bio
Date Reply #9 on Mon 29 May 2006 08:17 PM (UTC)
Message
It's probably a mix of Perl, Python, and Lua in syntax. Ruby is said to look almost exactly like Python if you indent it properly and strip the ends, but it would also look exactly like Lua if you replace defs with functions :)
[Go to top] top

Posted by Nick Gammon   Australia  (22,982 posts)  [Biography] bio   Forum Administrator
Date Reply #10 on Tue 30 May 2006 02:32 AM (UTC)
Message
Well I almost have Ruby working - excepting exporting functions from the script file. For example:


<triggers>
  <trigger
   enabled="y"
   match="Darkhaven"
   name="triggername"
   regexp="y"
   script="mytrigger"
   sequence="100"
  >
  </trigger>
</triggers>


This is trying to call "mytrigger" script, and this is in my script file:


def mytrigger (name, line, wildcards)
  @world.Note (name)
  @world.Note (line)
end 


It compiles OK, but says "The trigger (triggername) subroutine named "mytrigger" could not be found.".

Any clues about how to make the RubyScript engine make the function "mytrigger" available externally?

- Nick Gammon

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

Posted by Nobody   (38 posts)  [Biography] bio
Date Reply #11 on Tue 30 May 2006 06:15 AM (UTC)
Message
Well, I can't see why it can't be found, however when I installed rubyscript I noticed a weird... thing. I actually have 2 options for ruby scripting languages: GlobalRubyScript.1 and RubyScript.1

I don't know why this is, nor do I know the difference between them - however, I do know that the GlobalRubyScript.1 gives me lots of errors and weird bugs when I use it for my scripts, but if I use RubyScript.1 everything compiles and works just fine.

I also don't know how your program is written, or what language it's written in, but in the source code I've seen, it uses the "ParseScriptText" function of the activescripting engine to handle the script, and that works just fine for my ruby scripts. I have no idea why you would get a 'function not found' error though.

There's an ebook that's used to help people with ruby - it's pretty comprehensive. I've used it for all my ruby programming to date. I can't remember the exact url, but it's on the ruby website somewhere, and it tells you how to extend ruby to other languages and how to link the two together - maybe that will help you.
[Go to top] top

Posted by Nick Gammon   Australia  (22,982 posts)  [Biography] bio   Forum Administrator
Date Reply #12 on Tue 30 May 2006 07:36 AM (UTC)
Message
I use RubyScript which sounds like what you are using (without the .1), and I think internally I call ParseScriptText for all the script languages (except Lua).

The problem is not that it parses badly, but it doesn't seem to export the function as an external callable function.

From what I can see mytrigger will be a local function, which perhaps is not exported, however trying to make a global function doesn't parse, eg.:


def $mytrigger (name, line, wildcards)
  @world.Note (name)
  @world.Note (line)
end 


I am not enough of a Ruby expert to know what, if anything, I am doing wrong, and how to fix it.

- Nick Gammon

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

Posted by Nobody   (38 posts)  [Biography] bio
Date Reply #13 on Wed 31 May 2006 07:54 AM (UTC)
Message
I'm not an expert either, and as far as I can tell, your script looks syntactically fine (except for making a global function using $). The only thing I can think of is maybe it's declaring the function as private, when it should be declared as public. However, according to the documentation, all methods are public by default. Try declaring it as public, just in case - frankly I doubt that's the problem though.

If all else fails, you have a couple of things you can try. If you set the scripting language to ruby, and define a function in the scriptfile, does that work (ie. without going through the trigger framework)? It's possible that for some reason your scripting engine is causing some kind of problem, email me and I can give you a few things to test out. There's a whole bunch of stuff that ruby can do to help you with debugging, but since I don't know what's failing and where, I can't really offer any advice. As far as I know, the script you wrote should work.

If you wish to send me the ruby-enabled version so I can test it, that'd be okay too (although I'm not sure how much time I can put into it or how much help it'll be).
[Go to top] top

Posted by Nick Gammon   Australia  (22,982 posts)  [Biography] bio   Forum Administrator
Date Reply #14 on Thu 01 Jun 2006 12:48 AM (UTC)
Message
Quote:

If you set the scripting language to ruby, and define a function in the scriptfile, does that work (ie. without going through the trigger framework)?



Hmmm - when I first tested this it worked:


@world.Note "test" # --> echoes "test"


However this doesn't:


def test()
  @world.Note "hi there"
end 

test()  # --> error: wrong number of arguments


Not sure what this is about. The same code running in the stand-alone version works (replacing @world.Note by print).


- 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.


45,343 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] 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]