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
➜ io language - and Ruby
It is now over 60 days since the last post. This thread is closed.
Refresh page
Pages: 1
2
| Posted by
| Nick Gammon
Australia (23,173 posts) Bio
Forum Administrator |
| Date
| Reply #15 on Thu 01 Jun 2006 12:53 AM (UTC) |
| Message
| It gets a bit weirder. I thought maybe "test" was some kind of reserved word, so I re-did it using nickgammon as the function name. I guess that isn't a reserved word :P .
def nickgammon()
# @world.Note "hi there"
end
nickgammon() # --> undefined method `nickgammon' for #<Module:0x1b65038>
Well, I just defined it right there! And if my syntax is wrong, how come "test" works? Again, that works in the stand-alone version:
def nickgammon()
print "oops"
end
nickgammon() # --> "oops"
|
- Nick Gammon
www.gammon.com.au, www.mushclient.com | | Top |
|
| Posted by
| Nobody
(38 posts) Bio
|
| Date
| Reply #16 on Sat 03 Jun 2006 04:21 AM (UTC) |
| Message
| Very weird. Clearly it's working on the engine ok, otherwise @world.note wouldn't work. There must be some issue to do with scoping and function declarations. I've never seen it do anything like this before though.
Yes, test is reserved (well, not reserved, it's defined in the kernel module and is similar to the linux test command for finding out information about files).
Okay, try this. Stuff works ok without defining a function right? To double check this, make a few variables, change them around a bit, and double check that everything works ok. I'm confident it willl, but when I'm debugging stuff like this I always like to go very slowly and very thoroughly.
If that's ok, then try defining a function, like your previously mentioned nicgammon function, but instead of trying to call it from within the script, can you call it from the source code using ParseScriptText() ? I realise it's a kludge, but I'm struggling to figure out why a defined function isn't being found.
Is there any chance you could send me the modified binary (or dll, or whatever) that has ruby working, so I can play around with it myself? (I love to fiddle).
Oh, one thing I just thought of. I think ruby is a bit like C++, in that it tries to find functions that take the correct number of arguments. It's possible that there are arguments being thrown in somehow, and since your function doesn't accept arguments, it says it can't be found.
What about if you defined a few more functions that have 1, 2, 3 and 4 arguments, and then you can figure out which one is being called.
Also, there is some easy ways to get debug information about which functions are available.
if you do something like this in your script:
def ng
@World.note "hi"
end
@world.note("Public methods:\n")
@world.note(public_methods + "\n")
@world.note("Private methods:\n")
@world.note(private_methods + "\n")
@world.note("Protected methods:\n")
@world.note(protected_methods + "\n")
This will print out all methods that are public, private, and protected. You'll probably get alot of them, but you're looking to find the "ng" one. It *should* be in the public methods list (when I tested it using the ruby interpreter, that's where I found it), but if it's not showing up there, that may indicate a problem.
That's all I can think of for now. | | Top |
|
| Posted by
| Nick Gammon
Australia (23,173 posts) Bio
Forum Administrator |
| Date
| Reply #17 on Tue 13 Jun 2006 02:27 AM (UTC) |
| Message
| That didn't really work.
Look, it seems to me that the Ruby Active Script interface isn't working, plain and simple.
I have had similar problems in the past with things like PHP and Tcl. The initial implementations weren't perfect, and after they got up to about a year in, it would work, with no effort on my part.
Internally in MUSHclient the only difference between the script interface for (say), VBscript and JScript is simply the string that is supplied to instantiate the script engine. After that it should work. Since 6 script engines already work fine (plus Lua which doesn't use Active Scripting) I think I can say that the MUSHclient script interface is working OK. |
- Nick Gammon
www.gammon.com.au, www.mushclient.com | | Top |
|
| Posted by
| Nobody
(38 posts) Bio
|
| Date
| Reply #18 on Tue 13 Jun 2006 06:49 AM (UTC) |
| Message
| Anything's possible.
I, however, have ruby installed and have another client that uses the (presumably) same scripting interface, and ruby works just fine for me in that program. I also have perl, vbscript, and java as options for the scripting language of that other program, and they all work fine too. | | 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.
68,224 views.
This is page 2, subject is 2 pages long:
1
2
It is now over 60 days since the last post. This thread is closed.
Refresh page
top