[Home] [Downloads] [Search] [Help/forum]


Register forum user name Search FAQ

Gammon Forum

[Folder]  Entire forum
-> [Folder]  MUSHclient
. -> [Folder]  Jscript
. . -> [Subject]  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] Refresh page


Posted by Viper2003   (2 posts)  [Biography] 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
[Go to top] top

Posted by Nick Gammon   Australia  (22,975 posts)  [Biography] 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
[Go to top] top

Posted by Nick Gammon   Australia  (22,975 posts)  [Biography] 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
[Go to top] 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.


10,123 views.

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

Go to topic:           Search the forum


[Go to top] top

Quick links: MUSHclient. MUSHclient help. Forum shortcuts. Posting templates. Lua modules. Lua documentation.

Information and images on this site are licensed under the Creative Commons Attribution 3.0 Australia License unless stated otherwise.

[Home]


Written by Nick Gammon - 5K   profile for Nick Gammon on Stack Exchange, a network of free, community-driven Q&A sites   Marriage equality

Comments to: Gammon Software support
[RH click to get RSS URL] Forum RSS feed ( https://gammon.com.au/rss/forum.xml )

[Best viewed with any browser - 2K]    [Hosted at HostDash]