Scripting 101 needed for Script-Illiterate

Posted by Adriana on Tue 27 Apr 2004 12:00 AM — 44 posts, 148,134 views.

#0
I know this sounds rather primitive since everyone here basically knows how to script and all BUT I'm really really REALLY interested in learning how to script triggers and aliases (or plugins?) for MUSHclient. Specifically for Iron Realms games (Aetolia, Achaea, Imperian). However, I have no idea how to start learning. And I'm talking about the absolute basics. Not intermediate knowledge or anything. I'm completely uncomprehending of how to set up a variable for MUSHclient. If anyone can help, I'd be ever so incredibly grateful!!! Just email me.


P.S. I've read as many help files as I've been able to find and I still don't fully understand how to do things as simple as an alias. I can do it via the game that I play but trying to get aliases by mushclient to work for the game just never happens. It doesn't register it. And it hates my targets.
Australia Forum Administrator #1
It would help to give examples, you can copy the alias giving you problems by selecting it in the alias list and clicking the "copy" button. Then paste it here in the forum.

Also, tell us what you type, and what you expect to happen.

A simple alias I like to start with is a "kill" alias to save typing.

eg.


Match: k *
Send: kill %1


For a bit more fun you can make a trigger detect a mob attacking you.

eg.


Match: The * grazes you.
Send: %1
Send to: variable
Variable: target


This would set up a "targetting" trigger.

You could then use the target in another alias:

eg.


Match: k
Send: kick @target
Expand variables: checked


Actually so far this hasn't needed any scripting. However that should get you started. If you want more help give a specific example of what you are trying to do.
#2
I can understand what you're showing me but I don't even know how to set that up....or where to set it up rather.

The alias that I'm having problems with is exactly that, actually. Do I need to download anything extra for MUSHclient to acknowledge what I'm writing? I have absolutely NO knowledge of javascript, jscript, vbscript, perlwhatever, or anything else of that type. I'm script-illiterate.

*sighs* But anyway, yea that's a basic alias I would love to have but haven't been able to make work.

Oh yea and for instance, my main character on Imperian is Vega. She's a Saboteur that uses a whip to garrote people and things to death. So her command for attacking something or someone is: garrote <target>

ST TAR &TAR allows me to set a target

SETALIAS RR GARROTE &TAR allows me have an alias that will garrote whatever I set the target to be and then instead of typing out garrote so-and-so, I can just ST TAR <target> and then type rr so that I can garrote said target.

Amended on Tue 27 Apr 2004 03:28 AM by Adriana
Australia Forum Administrator #3
Er, which one? I did two aliases there and a trigger.

I assume you are asking about the "target" one.

First, the trigger. Copy the following lines:




<triggers>
  <trigger
   custom_colour="2"
   enabled="y"
   match="The * grazes you."
   send_to="9"
   sequence="100"
   variable="target"
  >
  <send>%1</send>
  </trigger>
</triggers>



Go into MUSHclient's triggers configuration list and click the "paste" button. That will put the trigger there, then you can edit it and look at how it works. Then copy this:



<aliases>
  <alias
   match="k"
   enabled="y"
   expand_variables="y"
   sequence="100"
  >
  <send>kick @target</send>
  </alias>
</aliases>



Go into MUSHclient's aliases configuration list and click the "paste" button. Then check out how the alias works. You can model yours on those.
#4
I edited my previous post, by the way. I forgot to add a couple of things before posting.

ANYWAY, thank you for showing me what to enter and where. Now I'm kinda curious as to what it all means. What do all of those send /send things mean? Why does it look like HTML? What does sequence mean? Am I being too annoying? Cos seriously, I don't want to be a pain. I just wanna learn how to do these things (meaning understanding them well enough that I can eventually teach myself how to script other things).

I took computer programming and logic but it just showed me basic structure. It didn't teach me an actual script language. And the books I've bought on javascript are no help at all because they all deal with webpages and I don't want to learn it for webpages.

I'm such a problem.

Australia Forum Administrator #5
If you are not sure what I mean by the 'paste' button, check out Weapon help.
Australia Forum Administrator #6
It looks like HTML, yes. It is actually XML which is similar in concept.

The reason for that is it is a simple way of letting forum users copy and paste triggers/aliases etc. via straight text (eg. this forum) or in emails to each other.

When you paste this stuff into MUSHclient it parses the XML fields and fills in the appropriate entries in the trigger/alias etc.
#7
.....you lost me now.
Australia Forum Administrator #8
Your TAR alias could be this:


<aliases>
  <alias
   match="TAR *"
   enabled="y"
   variable="target"
   send_to="12"
   sequence="100"
  >
  <send>SetVariable "target", "%1"
ColourNote "white", "blue", "Target now %1"</send>
  </alias>
</aliases>


Then you could type: TAR nick

That would set "target" to "nick"
Amended on Tue 27 Apr 2004 03:55 AM by Nick Gammon
#9
and where exactly do I put that?

USA #10
Sorry, this isnt nessisarily related to this problem. But the thread name is just so good..

Nick, I know weve discussed making something for newbies in the past, as a collaborative thing, etc. I know most of us are willing to help, we just need some sort of organization to get started and stuff.

Have you thought about a wiki? Or at least, A wiki while its being developed. Or some derivative thereof (maybe only certain people can edit).

I know I was thinking about writing something for people to learn scripting... just yesterday. But its a daunting task for one person to do. Or even to get started with, theres so many ways to go about doing it.

I guess I just wanted to throw that out there, as I think a wiki would be a good way to do it. Id host it myself, but my hosting company has a lot of red tape when it comes to perl modules. I think itd be easier for you to implement, but I wouldnt mind setting it up if youre reluctant for whatever reasons.
#11
Yes, the thread name is rather witty, isn't it? *grins*
USA #12
where exactly do you put... that..

The alias, copy it from <aliases> to </aliases> (so its on your clipboard) then go to the alias menu, and click paste.

If youre talking about the TAR thing, you just type that in. As if you were sending a command to the mu*.
Australia Forum Administrator #13
I haven't used a wiki, but a quick browse seems to indicate it is a collection of web pages that people can add to and edit.

In what way is that different to the existing forum?

If you like I can make a new section (eg. hints for beginners) that you can contribute to in the usual way.

The current system has a lot of the things in it that I think are helpful for a database like this:

  • Forum codes for bold, italic, fixed-pitch examples, bulleted points etc.
  • Some control - you have to join to post, you can't amend other people's posts
  • Searching
  • Entries are dated


About the only thing that seems to be really missing is cross-referencing, and that could be added. eg. you might put in the thread number of a related thread to link things together a bit more.




Having said that, I like the idea of some sort of introductory pages. This entire forum is supposed to be a large knowledge-base however it is getting to the stage where it is sometimes hard to separate out minor problems that people have with posts of major tutorial significance.
Australia Forum Administrator #14
Did you read this post? It has a graphic, even.

Unfortunately the person who started that thread got the idea into their head to delete their question once I posted the answer, so the answer is out of context a bit, however it still shows how to use the pasting idea.

Amended on Tue 27 Apr 2004 04:10 AM by Nick Gammon
USA #15
Wikis, hmm, Well, yes, cross referencing, but basically, its just a whole subset of pages that can be edited by whomever (if theres no restrictions) or by certain people (have to log in type thing). It allows anyone to edit.

There is protection against someone coming in and deleting everything, which is the first response most people have.

So yes, it is a bit like the forum, however, instead of simply having one huge post, it would be split up into pages, where people can add directly into the page (rather than replying, and being out of context). I think it would be a little less daunting, its more like what most people know (that is, a bunch of pages with links, rather than a forum) and lends itself to piecewise consumption, and later reference.

Not that Im bagging on this forum or anything. I just think it might be more helpful. If we had some sort of walkthrough. Rather than getting a million posts about how to copy/paste triggers, or someone who doesnt understand how to use variables, or whatever. Or how the inbuilt script functions work with the scripting languages.

Edit:

Also covering some more things you brought up. Wikis do allow for bold, and other things like that. Depending on which one you get, theres different ways to do things.
And you can have people have to login to edit (there are wikis with user accounts, etc). For everyone else, itd just be a group of webpages.
And most wikis have a search feature.
Amended on Tue 27 Apr 2004 04:35 AM by Flannel
Russia #16
Mmm, a wiki... That would be nice. Right now, when people ask me for basic help with Mushclient I go to the forum, search it and reply with links to whatever posts about general newbie tutorial-like stuff I find. A wiki could be used to keep a collection of howto's and tutorials, edited by whoever can and wants to, and it would be much easier to reference since most wikis are pretty well structured.
Australia Forum Administrator #17
Yes, well I have been experimenting a bit with a PHP Wiki (called PHPWiki) and I see how it could be useful.

The forum tends to be linear, whereas a Wiki would let you (or anyone who wants to) to update and improve the documentation with explanations, hyperlinks to examples, and so on.

Good idea. :)
USA #18
Nick, one thing to keep in mind, and you might have to edit something to add a "code" tag or whatnot, is that we will be posting preformatted stuff, and we dont want to have to worry about it eating quotes (or asterisks), and other important things.

So, might want to have some sort of code tag, like we do here.

Edit: I guess it already does, the pre tag, but does it ditch all the other parsing? Or are we going to end up with links in the middle of our code?
Amended on Tue 27 Apr 2004 07:30 AM by Flannel
Australia Forum Administrator #19
Yes, I was worried about that too, for obvious reasons.

The one I am experimenting with supports the <verbatim> tag which seems to allow you to post scripts etc. without too much trouble.
#20
well really what I'm looking for is a step-by-step explanation for each apostrophe, each space, each letter, each number that is written in a script. The reason why I want to know is that I want to understand the actual language. I can't do a damn thing with it if I don't understand what you're giving me to copy and paste into a program I'm trying to get familiar with. Try and put yourself in my shoes for a moment. You're completely unlearned in the ways of scripting. You don't even know a script language. But you wanna learn. A play-by-play explanation would be awesome. :)
USA #21
Right.. The mud equivalent of starting with "Hello World". Funny thing is you could even do that. lol
Australia Forum Administrator #22
The stuff I have posted so far is really just the XML equivalent of a trigger/alias, although my later one had a couple of script commands in it.

Things like:


<alias
   match="TAR *"
   enabled="y"
 ...


Simply means "add an alias". The "match" field is "TAR *". The "enabled" flag is checked. And so on.

I also posted this:


SetVariable "target", "%1"
ColourNote "white", "blue", "Target now %1"


All these things (eg. SetVariable) are documented in the help file that comes with MUSHclient, and also here:

http://www.gammon.com.au/scripts/doc.php

Simply search (on the web page or in the help) for a word, eg. SetVariable, and it will explain what it does.




However, following up from the earlier suggestion, I am setting up a wiki and will have it ready for people to start adding stuff to it in around 24 hours from now.

Basically this means that people who know this stuff, like Shadowfyr, Flannel and others who have used MUSHclient a bit, can write up "how to" pages and add examples, explanations and so on.

This should be quite helpful for beginners, and also serve as reference material for more experienced users.


Australia Forum Administrator #23
The wiki is now available at http://www.gammon.com.au/wiki/index.php/HomePage.
Greece #24
I also think it would be a good idea to change the colors/background to make it feel more like the forums, don't you agree?
Greece #25
By the way, is there a way for users to log on to the Wiki using their name?
Amended on Sat 01 May 2004 12:59 PM by Poromenos
Greece #26
Also, I was thinking of having a suggestion list on the Wiki, so that people know what is about to be implemented and they could be removed when they are implemented in future versions. This way people can see the TODO list and not ask for things already asked for, etc
USA #27
Couldnt Just edit your post there Poromenos? heh.

Anyway, the beauty of the wiki is you can go and ADD the Suggestions page. Dont need to ask permission, or wait for implimentation. Or... do you mean a suggestion page here.
(Which does make sense, since a lot of average joe users will be uncomfortable editing a wiki, especially at first)

Technically, you could change the color as well, but itd be a very crude hack, as Im sure nick has some "default color" variable. Rather than poor you going through each page. So Id leave that up to him.

Edit: You can log in, its in the bottom right corner. Except you'd need an account, none of us have them yet.

Also, It sees the homepage is locked, so you couldnt add a todo list anyway. Well, not to there. And Poromenos, the TODO list is a great idea.
Amended on Sat 01 May 2004 06:48 PM by Flannel
Australia Forum Administrator #28
Are you having trouble creating accounts? It seems to me that logging in creates one. Then once it exists you can give it a password.

Once you have an account, which should only take you one minute, you can change "user preferences" - one of those is to choose between about 10 "themes" for the wiki pages. None is the "Gammon Forum" theme, and I suppose I could add that, but you can certainly change the appearance.

As for the "to do" list, only the very home page is locked, and a few other pages for administrative purposes.

I presume the "to do" list is for MUSHclient? Then, make your own "todo" page on the *MushClient* page. Ditto for AreaEditor, SMAUG, etc.

The only time the main home page should need changing is if someone wants a whole new major link. That way it stays reasonably organised.

Amended on Sat 01 May 2004 09:16 PM by Nick Gammon
USA #29
When I try to login, or rather "post as" it says my account doesnt exist. This Error:
lib/WikiDB/backend/PearDB.php:765: Fatal[256]: wikidb_backend_mysql: fatal database error

DB Error: no such table
(SELECT userid FROM user WHERE userid='Flannel' [nativecode=1146 ** Table 'gammon_com_au_2.user' doesn't exist])


And actually, whenever I click the link, I get this error:
The XML page cannot be displayed
Cannot view XML input using XSL style sheet. Please correct the error and then click the Refresh button, or try again later.


--------------------------------------------------------------------------------

Cannot have a DOCTYPE declaration outside of a prolog. Error processing resource 'http://www.gammon.com.au/wiki/index.php/HomePage';. Line 4, Position 11

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
----------^


Until I refresh.
Greece #30
Yes, it did that for me too, looks like the table hasn't been created yet... As for the suggestions page, I meant that Nick has all the suggestions in one place, so I can't add the page because I don't know what they are :)
USA #31
I agree. This wiki is going to have to have some centralized pool. Itll take some organization. Since, if someone posts a question on some obscure page, chances are we wont see it (well, except for the recent changes). But, if theyre all in a list, people can just add things as they feel like it, and remove them from the list.

This probably isnt too coherent.
Australia Forum Administrator #32
I've fixed the login, I hope. I missed a line in the configuration file.

As for suggestions, there is no suggestions page yet. I'll try to add a bit of stuff to the MushClient wiki page.
USA #33
Now I get "insufficient parameters".

Or rather, signing in brings me to the config page, then I get the IP message.
Australia Forum Administrator #34
I am not getting any errors setting up test accounts. Can you paste the exact message? What do you do, exactly? Create an account, and then update prefs, or not get that far?
Greece #35
First of all, when I open mushclient.com/wiki/ it says:

lib/Request.php:339: Warning[2]: ob_start(): output handler 'ob_gzhandler' cannot be used after 'URL-Rewriter'


Then, i type Poromenos in the "Sign in as" box and it says "Insufficient permissions". I press the sign in button to see if it will let me do anything, and it just takes me to the same page.
Australia Forum Administrator #36
The message about 'ob_gzhandler' I get when I first go to the wiki, it seems to go away after that.

I'm not sure why you can't log in, I created a test user that can, but I can't see your name in the database anywhere except on a couple of posts. Strange. Ah well, this is what happens when you don't write the software yourself. I'll keep looking into it.
USA #37
http://mud.bussett.com/wiki.png

Thats the thing, also, It LOOKS like (the properties) the sign in button doesnt actually sign in? I dont know how it works, but, it looks like its trying to go back and browse.

Also, yeah, the errors about the header (for me, that I posted earlier) happens the first time, but then not after that.
Greece #38
Does the server have adequate permissions to write to the database file? Maybe you can because you're logged on as an admin or whatever?
Australia Forum Administrator #39
I have taken out compression, that should get rid of the message about 'ob_gzhandler'.

Reading the FAQ I think your problem Poromenos is that the login name needs to be a WikiWord (middle caps).

Don't ask me why it may have allowed it before. :)

eg. Try this: PoroMenos (or PoromenosSomething), as I am successfully using NickGammon.

And yes, the database has only one password, and we are all using that. ;)
Greece #40
Bah, I've given up on it. The server closed the connection when I tried to update my user details and now it closes it when I try to sign in... Can it be so buggy? Did you maybe miss a config line somewhere?
Amended on Sun 02 May 2004 11:27 PM by Poromenos
Australia Forum Administrator #41
It works for me and my test characters, so I don't know what the problem is. Did you capitalise your name like I suggested.

I don't want to spend weeks working on this, it was supposed to be a quick way of doing documentation. If I spend much longer on their code I may as write it myself.

In any case, you can make anonymous posts.
Greece #42
It accepted the name, but it started acting funny after a bit... I'll try again now.
Greece #43
OK, I just entered PoroMenos in the sign in as box and the server closed the connection on me. I have no idea what is going on, do you get the same error? And I agree, fixing wiki bugs is a bit of a waste of time...