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
➜ General
➜ OnConnect
It is now over 60 days since the last post. This thread is closed.
Refresh page
Posted by
| Katie Love
(19 posts) Bio
|
Date
| Fri 16 Jan 2009 08:01 PM (UTC) |
Message
| I have a bunch of variables I would like reset on connect. Is there a way I can trigger an alias or script when I connect to a mud? It seems like something easy that should be documented but I've been trying and I can't seem to find the information.
Thanks!!! | Top |
|
Posted by
| WillFa
USA (525 posts) Bio
|
Date
| Reply #1 on Fri 16 Jan 2009 08:19 PM (UTC) Amended on Fri 16 Jan 2009 08:21 PM (UTC) by WillFa
|
Message
| Go to the Scripting... Preferences (CTRL+SHIFT+6)
And fill in the names of Script functions into any World Events that you want. :) | Top |
|
Posted by
| Katie Love
(19 posts) Bio
|
Date
| Reply #2 on Sat 17 Jan 2009 04:14 AM (UTC) |
Message
| Thanks!
It's working now -- but...
Every time I seem to make a change to my aliases/triggers/etc it is dropping the script file and I'm having to reload it. It must be a setting somewhere. It's really annoying to have to reload it all the time.
Anyone experience this? | Top |
|
Posted by
| Nick Gammon
Australia (23,133 posts) Bio
Forum Administrator |
Date
| Reply #3 on Sat 17 Jan 2009 05:08 AM (UTC) |
Message
| What do you mean by "dropping the script file"?
Normally simply changing an alias should not affect the current script file. |
- Nick Gammon
www.gammon.com.au, www.mushclient.com | Top |
|
Posted by
| Katie Love
(19 posts) Bio
|
Date
| Reply #4 on Thu 19 Feb 2009 09:10 PM (UTC) |
Message
| Since it looks like I have to move at least one alias into a script, I figured I should resurrect this thread.
The error message I get can be found here: http://imagebin.ca/view/szC-x6ml.html
The error message appears everytime I hit "ok" or "cancel" on the Configuration window (the window where I can add aliases, macros, scripts, varaible, etc)
My Achaea.lua file contains the following:
function OnConnect (name, line, wildcards)
SetVariable("Connecting", "1")
end -- function
The only other relevant piece I can thing of is in the configuration window, under World Events. A screenshot of that is here: http://imagebin.ca/view/SMGGew.html
Thanks!!! | Top |
|
Posted by
| Nick Gammon
Australia (23,133 posts) Bio
Forum Administrator |
Date
| Reply #5 on Thu 19 Feb 2009 09:30 PM (UTC) |
Message
| Can you show the whole scripting configuration window, not just the bottom bit?
Anyway, the OnConnect function does not take arguments (name, line, wildcards: only apply to aliases and triggers). However that won't matter under Lua.
|
- Nick Gammon
www.gammon.com.au, www.mushclient.com | Top |
|
Posted by
| Katie Love
(19 posts) Bio
|
Date
| Reply #6 on Fri 20 Feb 2009 03:50 AM (UTC) |
Message
| The entire window is here: http://imagebin.ca/view/VeNPn5LK.html
I've tried multiple combinations of things. Rather frustrated right now :-(... | Top |
|
Posted by
| Nick Gammon
Australia (23,133 posts) Bio
Forum Administrator |
Date
| Reply #7 on Fri 20 Feb 2009 04:17 AM (UTC) Amended on Fri 20 Feb 2009 04:18 AM (UTC) by Nick Gammon
|
Message
| I can't really explain it. I tried myself and the OnConnect worked fine.
The only things I can think of are:
- Some subtle spelling problem, where an "oh" is a zero somewhere. Try copying and pasting the OnConnect word from the script configuration to the script file to make sure.
- The script file you pasted is not in fact the one referenced in the script configuration (that is, you have two Achaea.lua files). Try hitting the Edit button in the script configuration to confirm that the correct file actually opens.
BTW - what version of MUSHclient are you using? |
- Nick Gammon
www.gammon.com.au, www.mushclient.com | Top |
|
Posted by
| Katie Love
(19 posts) Bio
|
Date
| Reply #8 on Fri 20 Feb 2009 05:13 PM (UTC) |
Message
| I'm running MUSHclient 4.37.
Sadly, I have thought of both of those things and tried them. They didn't work. I actually just tried them again for giggles and it still didn't work.
I would love to move some things into the script file -- in fact i'm about to create a recursive funciton, which would need the script file. I've tried reinstalling as well.
I can't shake the feeling it's some small thing, but I can't figure out what. | Top |
|
Posted by
| Katie Love
(19 posts) Bio
|
Date
| Reply #9 on Fri 20 Feb 2009 05:23 PM (UTC) |
Message
| ** Update **
I changed the function name from OnConnect to Foo and it *appears* to be working. I've been trying to get the error to pop up again with no success.
Of course, I'll want to do some scripting for a bit before i'm 100% sure this worked. Is it possible OnConnect is some sort of reserved word? | Top |
|
Posted by
| Nick Gammon
Australia (23,133 posts) Bio
Forum Administrator |
Date
| Reply #10 on Sat 21 Feb 2009 01:27 AM (UTC) |
Message
| No it isn't.
My only explanation now is that your script file is perhaps larger than the 3 lines you posted, and that somehow you change the OnConnect variable to something else. For example:
function OnConnect ()
print "connected"
end -- OnConnect
--- 500 lines of code here ...
OnConnect = {}
Now that code gives the error message "The world connect subroutine named "OnConnect" could not be found." - this is because OnConnect is now a table and not a function.
One thing you could try is, after processing the script file, and seeing the error message, go into the immediate window and type:
After mucking up the script file (as above) it printed "table".
It should be "function". Or maybe it would print "nil".
|
- Nick Gammon
www.gammon.com.au, www.mushclient.com | 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.
27,321 views.
It is now over 60 days since the last post. This thread is closed.
Refresh page
top