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 ➜ Jscript ➜ binding several lines of text via SetAliasOption to the "send" field

binding several lines of text via SetAliasOption to the "send" field

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


Posted by Viper2003   (2 posts)  Bio
Date Wed 11 Feb 2004 05:41 AM (UTC)

Amended on Wed 11 Feb 2004 05:43 AM (UTC) by Viper2003

Message
I was wondering if anyone knew how to bind multiple lines to the send field of an alias on the fly.

Basically I have an alias labelled "numpad5" which I have bound to that location on the keyboard. Everytime I enter a new area that I have a predefined alias to, I rebind this alias to a new line of text such as:

/world.SetAliasOption("numpad5", "send", "k ant");

So I can navigate the area and attack mobs with ease by using the numeric keypad.

However, I would also like to be able to rebind this alias for multiple lines so I could for example cast a spell as well. So the send field would contatin something like:

k ant
cast magic misile ant

But I do not always want this alias to contain more than 1 line of text.

One work around I worked out was setting a target variable and retrieving the contents of this variable and instead having the contents of the variable change but not the alias itself.

Is there anyway to insert newlines into an alias send field via SetAliasOption?

Newlines seem to work in AppendToNotepad eg:

world.AppendToNotepad("Tell Monitor", theoutput + "\r\n");

but not in SetAliasOption:

world.SetAliasOption("numpad5", "send","kill blah\r\nr blah");

and instead it appears all on the same line when I check the alias:
kill blahr blah
Top

Posted by Nick Gammon   Australia  (23,169 posts)  Bio   Forum Administrator
Date Reply #1 on Wed 11 Feb 2004 06:01 AM (UTC)
Message
You have found a bug in SetAliasOption that will be fixed in version 3.44, being released in a few days probably.

For the time being, use your idea of the variable, or just wait for the new version.

A similar bug applies to SetTriggerOption and SetTimerOption.

- Nick Gammon

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

Posted by Nick Gammon   Australia  (23,169 posts)  Bio   Forum Administrator
Date Reply #2 on Wed 11 Feb 2004 06:03 AM (UTC)

Amended on Wed 11 Feb 2004 08:27 PM (UTC) by Nick Gammon

Message
Another work-around would be to do this:

Set the "send" to:

Send "kill blah" & vbCrLf & "r blah"

Then set the alias to "send to script", ie.

SetAliasOption "numpad5", "send_to", "12"



(edit)

Sorry, this is JScript not VBscript, so it would be a bit different, like:

world.SetAliasOption ("numpad5", "send", "Send (\"kill blah\\\\nr blah\");");

The heap of backslashes are there to stop the \n becoming a \n until the right moment.

I typed that in the command window, in a script you can probably reduce them from 4 to 2 backslashes, but I would experiment.

Then, in Jscript the other line becomes:

SetAliasOption ("numpad5", "send_to", "12");




- 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.


13,519 views.

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.