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
➜ help with auto movement, and a couple of questions on scripting
help with auto movement, and a couple of questions on scripting
|
It is now over 60 days since the last post. This thread is closed.
Refresh page
Posted by
| Acton
(13 posts) Bio
|
Date
| Tue 01 Apr 2008 10:25 PM (UTC) |
Message
| Hello,
I'm working on a movement script. that when it sees the line of text "You are now running along the edge of Oakdale Forest." it will change a variable, to either east, or west, and call a move function that will trigger something like west, or what ever the variable is set to.
I understand the basics of vbs, just can't figure out how to get this working.
Also, I'm blind, and using a screen reader. the hlp file that comes with mushclient isn't very accessible, and the scripting tutorial that uses pictures doesn't work the best.
Is there a way I can see what all functions are located in the world, and any other mushclient namespaces?
Last, I know more php than vbs. how hard is it, for me to get php working? I've seen a link here somewhere for a dll, but it's never worked well for me--basically it doesn't work. :)
| Top |
|
Posted by
| Nick Gammon
Australia (23,133 posts) Bio
Forum Administrator |
Date
| Reply #1 on Wed 02 Apr 2008 12:44 AM (UTC) |
Message
| This site makes a fairly big effort to be accessible to people using non-standard web browsers. Hopefully the forum is reasonably easy to use for visually impaired users.
However having said that, there is the saying "a picture is worth a thousand words", so in a few places, particularly the scripting introduction, I illustrated my tutorial with some graphics. A quick browse of that page seems to show that it is fairly readable without the graphics, but I will review it and see if I can explain in the text anything that might have been purely visible in a graphic.
You seem to be ambivalent about whether to use VBscript or PHP, may I recommend Lua? That is supplied built-in to MUSHclient, and is therefore somewhat more reliable than any language that uses the Windows Script Interface.
The syntax of Lua is similar to VBscript, and similar for that matter to PHP as well.
It is easier to get help on Lua, because everyone has Lua installed, and a lot of the more serious scripters on the forum are using it as well (not all, of course, my apologies to anyone this appears to be insulting).
Quote:
Is there a way I can see what all functions are located in the world, and any other mushclient namespaces?
All functions are listed here:
http://www.gammon.com.au/scripts/function.php
The help file should be useable, I am not sure why it is a problem to access it.
However the identical information is available from this site at this URL:
http://www.gammon.com.au/scripts/doc.php
This is generated from the same database, and is therefore identical to the help file. It is probably better to use the help file (or documentation link) because related functions are grouped there as cross-references.
If the online help is too slow to access, you can download the help file as HTML files, from this link:
http://www.gammon.com.au/files/mushclient/mushclient_help_4.15.zip
This effectively has each help topic as one HTML file, so you can view them in your web browser offline. This forum post describes it, along with some helpful scripts for doing searches:
http://www.gammon.com.au/forum/?id=7796
Now back to your original question. I suggest a trigger that matches the relevant text, and in the trigger you can do "send to script". In the script you can use the Send function to send a command to the MUD (eg. to go west), and use SetVariable to set a variable. You can use GetVariable to query a variable. |
- Nick Gammon
www.gammon.com.au, www.mushclient.com | Top |
|
Posted by
| Nick Gammon
Australia (23,133 posts) Bio
Forum Administrator |
Date
| Reply #2 on Wed 02 Apr 2008 06:42 AM (UTC) |
Message
| Lua (and some others) is a case-sensitive language, so it may be hard to get the capitalization right if the words are being read out to you, however this may help:
- The Lua syntax itself relies upon all lower-case words. Thus, words like "while", "repeat", "end" and so on are always all lower-case.
- MUSHclient functions (those you call from your script) however are usually capitalized with each "word" being started with an upper-case letter. For example, "Note" starts with a capital N and the rest is lower-case. However ColourNote has both the "C" and "N" capitalized, as it is really "colour" followed by "note".
As another example, AddTimer has a capital "A" for Add and a capital "T" for Timer.
- As I am Australian, I use English spelling, so the word Colour is spelt C-O-L-O-U-R, note the "U" in the middle.
|
- Nick Gammon
www.gammon.com.au, www.mushclient.com | Top |
|
Posted by
| Acton
(13 posts) Bio
|
Date
| Reply #3 on Thu 03 Apr 2008 01:41 AM (UTC) |
Message
| Hello,
thanks for the expediant reply.
I think I understand how this should work, but have trouble understanding how the "send to script," function will link to my script. will it send an argument to the function? I think, as I don't have time to learn lua with some current projects, I'll just keep going with vbs, for now. Anyway, is there some sorta sample on how to send to script, and make it change? Also, on my connect event, I have a line of code that looks like:
world.send("load myame, mypass")
it doesn't like that(using vbs). Any ideas?
Thanks, | Top |
|
Posted by
| Nick Gammon
Australia (23,133 posts) Bio
Forum Administrator |
Date
| Reply #4 on Thu 03 Apr 2008 02:51 AM (UTC) |
Message
| I suggest you take a look at the scripting introduction page:
http://www.gammon.com.au/scripting
I have finished amending it now to call out the graphics in text form as well, so you should be able to read it OK.
My quick reply is, if you use "send to script" then the "send" box is the script (hence, send to: script). The "send to" combo-box tells MUSHclient where to send whatever you have in the send box to. It might be the MUD (thus it effectively becomes input to the MUD), the output window, as a note to yourself, the script engine (for scripts), and various other options, like to a notepad window.
However if you want to put scripts in a separate script file (the name of which is in the scripting configuration dialog), then you can leave the "send" box blank, and instead put the function name to be called into the Script box.
The script function is called with three arguments: name of the trigger or alias, the matching line, and the wildcards array. Thus the first wildcard is the wildcards array, indexed by 1.
Quote:
I have a line of code that looks like:
world.send("load myame, mypass")
it doesn't like that(using vbs).
VBscript has a rather strange syntax rule that if you call a function without getting a return value, you must not use brackets. However if it returns a value, you must.
Thus, your line should read:
Send "load myame, mypass"
I have omitted the brackets. I have also omitted "world." as that is unnecessary and just is extra typing. |
- Nick Gammon
www.gammon.com.au, www.mushclient.com | Top |
|
Posted by
| Acton
(13 posts) Bio
|
Date
| Reply #5 on Thu 03 Apr 2008 05:28 AM (UTC) |
Message
| thanks. I'll take a look at that. :) | 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.
17,432 views.
It is now over 60 days since the last post. This thread is closed.
Refresh page
top