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.

Due to spam on this forum, all posts now need moderator approval.

 Entire forum ➜ MUSHclient ➜ Suggestions ➜ Ruby revisted

Ruby revisted

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


Pages: 1 2  3  

Posted by Ariesroyaal   (20 posts)  Bio
Date Sat 05 May 2007 12:42 PM (UTC)
Message
What would it take to get you to revisit Ruby? I am a long time Ruby developer and would love to see this in MUSHClient.

In the last post I saw about this you reported this error:

# --> undefined method `nickgammon' for #<Module:0x1b65038>

You could try defining a the script within a module

module NickTest
def nickgammon
@world.Note("Hello World!")
end
end

If you are willing to check it out again, I'd be willing to hash out any errors you run into.
Top

Posted by Nick Gammon   Australia  (23,140 posts)  Bio   Forum Administrator
Date Reply #1 on Sat 05 May 2007 09:47 PM (UTC)

Amended on Sun 06 May 2007 06:07 AM (UTC) by Nick Gammon

Message
I am not sure which version of Ruby I had installed - I got the latest one (1.8.6.2) from this page:

http://arton.hp.infoseek.co.jp/index.html

Namely this file:

http://arton.hp.infoseek.co.jp/ActiveRuby18.msi

However the file ActiveRuby18.msi was what I had last time. The old one was 4.50 Mb, the new one is 14.3 Mb, so obviously there are changes.

Before installing the new version I re-enabled it in MUSHclient and tried a test. Typing this into the command window worked:


/ @world.Note("Hello World!")


(Slash is the scripting prefix).

My earlier test file had this as a test trigger:


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


It compiled OK, but reported that there was no script function mytrigger.

I then did what you suggested and added a module to it:


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


That compiled OK too, but still couldn't find "mytrigger".

I then installed the latest Ruby (1.8.6.2), and then attempting to start MUSHclient resulted in an immediate crash with an access violation.


- Nick Gammon

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

Posted by Nick Gammon   Australia  (23,140 posts)  Bio   Forum Administrator
Date Reply #2 on Sat 05 May 2007 09:54 PM (UTC)
Message
I then uninstalled the latest version which crashes, and tried an earlier one (1.6.8.3):

http://arton.hp.infoseek.co.jp/ActiveRuby.msi


That seems to work (in the sense that it doesn't crash the client), and will display the "hello world" in the output window, but still doesn't recognise the "mytrigger" function.

My guess is that it isn't exporting things defined in Ruby to be available to the "outside world" - which is required if MUSHclient is going to call scripts by name.

I don't have a big problem with leaving it enabled, so you can try to experiment with it and get it to work.


- Nick Gammon

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

Posted by Nick Gammon   Australia  (23,140 posts)  Bio   Forum Administrator
Date Reply #3 on Mon 07 May 2007 11:18 PM (UTC)
Message
This new version is now available, if you want to play with it:

http://www.gammon.com.au/forum/?id=7863

- Nick Gammon

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

Posted by Ariesroyaal   (20 posts)  Bio
Date Reply #4 on Tue 08 May 2007 05:19 PM (UTC)
Message
Nick,

Which ActiveScript DLL are you using?

RScript.dll or GRScript.dll?
Top

Posted by Ariesroyaal   (20 posts)  Bio
Date Reply #5 on Tue 08 May 2007 05:33 PM (UTC)
Message
after reading up on it, you are probably using the regular RScript.dll. GRScript registers everything on the global level....

-waits impatiently for an update-
Top

Posted by Ariesroyaal   (20 posts)  Bio
Date Reply #6 on Tue 08 May 2007 05:33 PM (UTC)
Message
sorry.. excited to see it work even on in a small way ;)
Top

Posted by Nick Gammon   Australia  (23,140 posts)  Bio   Forum Administrator
Date Reply #7 on Tue 08 May 2007 09:03 PM (UTC)
Message
My quick answer is that I don't know. When you install Ruby, it links a DLL with "rubyscript" as the script engine. Thus the only word I needed to add in MUSHclient was "rubyscript" (plus various places where you get a choice of script engines).

I would have to check with RegEdit to see which DLL was actually registered by the Ruby installer.

- Nick Gammon

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

Posted by Nick Gammon   Australia  (23,140 posts)  Bio   Forum Administrator
Date Reply #8 on Tue 08 May 2007 09:24 PM (UTC)
Message
OK, I am getting a bit closer. It wasn't particularly obvious that I should have used "GlobalRubyScript" rather than "RubyScript".

Doing that seems to partly fix the problem. Now if I make a trigger it recognises that "mytrigger" exists in the script file, and thus the trigger can be added OK. However now it doesn't recognise the world functions:


Script error
World: SMAUG
Execution of line 3 column 1
Function/Sub: mytrigger called by trigger
Reason: processing trigger ""
undefined method `Note' for nil


This is my script:


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


I am presuming now that it needs to be told about the "world." functions somehow.

To recap, with "RubyScript", I could do this:


/ @world.Note ("hi there")


However, function names were not exported. With GlobalRubyScript function names are exported but "world" names are not imported.

- Nick Gammon

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

Posted by Ariesroyaal   (20 posts)  Bio
Date Reply #9 on Tue 08 May 2007 10:13 PM (UTC)
Message
world will probably be a global now, not an instance.

Try $world.Note instead of @world.Note.
Top

Posted by Nick Gammon   Australia  (23,140 posts)  Bio   Forum Administrator
Date Reply #10 on Tue 08 May 2007 11:29 PM (UTC)
Message
If I do this:


/$world.Note ("hi there")


I get this:


Script error
World: SMAUG
Execution of line 2 column 1
Immediate execution
undefined method `Note'
Line in error: 
$world.Note ("hi there")

- Nick Gammon

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

Posted by Ariesroyaal   (20 posts)  Bio
Date Reply #11 on Tue 08 May 2007 11:45 PM (UTC)
Message
maybe just use


world.Note might work as it is a local variable, as everything is global it would make sense that it could be just local now.

However it may be $World and not $world?

Lastly there are class variables...

@@world

----
GRScript.dll (progid="GlobalRubyScript") is an engine just fit for Windows Script Host Scheme.
It has no capability to handle multiple IActiveScript interface, but very similar environment to original Ruby.exe. Because the script evaluate always in the top level context, with global name space.
In addition with CScript (not WScript), you can use STDIN/STDOUT.

* Imported Objects are referenced as Global Variable. In Ruby, the global variable starts doller sign, so

sample script:

$WScript.Echo "Hello World !"
----

Top

Posted by Nick Gammon   Australia  (23,140 posts)  Bio   Forum Administrator
Date Reply #12 on Wed 09 May 2007 05:03 AM (UTC)
Message
None of those variations work, plus when I use GlobalRubyScript, for some strange reason, I can't connect to the world any more.

I get an error "Unable to create TCP/IP socket for "SMAUG", code 10022 (Invalid argument)".

Somehow Ruby is making TCP connections fail. I have to close and re-open MUSHclient before I can connect again.

- Nick Gammon

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

Posted by Ariesroyaal   (20 posts)  Bio
Date Reply #13 on Wed 09 May 2007 12:02 PM (UTC)
Message
That is odd. Also the new version of activescript is not crashing for me, maybe a conflict of some sort?
Top

Posted by Ariesroyaal   (20 posts)  Bio
Date Reply #14 on Wed 09 May 2007 12:08 PM (UTC)
Message
Im getting

Error number: -2147221231
Event: loading scripting engine
Description: Error -2147221231 occurred when loading scripting engine:

ClassFactory cannot supply requested class

Called by:


with the RScript version...
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.


95,845 views.

This is page 1, subject is 3 pages long: 1 2  3  [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.