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 ➜ Bug reports ➜ some new suggestions and some bugs???

some new suggestions and some bugs???

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


Posted by Smeagol   (10 posts)  Bio
Date Sun 13 Oct 2002 03:49 AM (UTC)
Message
First, I really want to add that mushclient is really nice on how it lets you script... I was just wondering if anybody ran into this problem... whenever i send a command in the timer like /world.DeleteVariable("test") it doesn't do it, and the only way i found around it was to send a note like delete("test") and a trigger would catch it and delete it, it seems that the text the timer sends should go through the interpretter before it gets sent into the output... i think that you should add a folder like zmud for triggers/alias/timers/variables/, and more options, like buttons, or buttons with text in them... and we should have our own status line above the command input and have a box option in preferences to have what variables/words we want in it... i also want you to know that the colourTell is very hard to use when things get really complicated and i know that this is how it is done in like java or c++, but i am wondering if there is a faster way to do it rather than world.ColourTell("black", "green", "Here,"); world.ColourTell("blue", "green,", "I"); world.ColourTell("white", "green", "am."); maybe something like world.Tell("green", %colour(black)"Here," + %colour(blue)"I" + %colour(white)"am."); You understand?? these are just suggestions but like if it makes your program slower.. don't do it...
Top

Posted by Nick Gammon   Australia  (23,133 posts)  Bio   Forum Administrator
Date Reply #1 on Sun 13 Oct 2002 04:59 AM (UTC)
Message
"Send text" in timers and triggers does not go through the command interpreter, you are right, however you can make them call a script, and in the script do:

world.deletevariable "test"

You can set the status bar (at the bottom below the command window) in a script.

You could make your own interpreter for colour codes if you wanted to with a bit of scripting (eg. ~r becomes red, that sort of thing). Perhaps in a future version that could become a built-in option.

- Nick Gammon

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

Posted by Faolong   USA  (28 posts)  Bio
Date Reply #2 on Mon 14 Oct 2002 03:09 PM (UTC)
Message
How would you script it in jscript so that ~r would make the next word red. I don't see any thing in your functions list that could do this... Maybe a return call could do it... Give some suggestions...
Top

Posted by Nick Gammon   Australia  (23,133 posts)  Bio   Forum Administrator
Date Reply #3 on Mon 14 Oct 2002 09:35 PM (UTC)
Message
What I meant was that you would write a routine that takes some text, looking for special characters (like ~) and does the world.colournote for you.

Something like this:

Split the text at ~ characters
Look for a letter after the ~
Do the appropriate world.colournote
Send the rest of the text in that block


- Nick Gammon

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

Posted by Faolong   USA  (28 posts)  Bio
Date Reply #4 on Wed 16 Oct 2002 02:19 AM (UTC)
Message
okay i actually have some code to match triggers with ~.

function misc_color(thename, theoutput, wildcardsVB) {
wildcards = VBArray(wildcardsVB).toArray();
var t_tell = world.Trim(wildcards[0]);
var t_color = t_tell.slice(0, 2);
var t_string = t_tell.slice(2);
var t_colourFore1 = world.GetVariable("colour_fore1");
var t_colourFore2 = world.GetVariable("colour_fore2");
var t_colourDisplay = world.GetVariable("colour_display");
var t_colourBack1 = world.GetVariable("colour_back1");

if(t_color == "ti") world.ColourTell(t_colourFore2, t_colourBack1, t_string);
else if(t_color == "di") world.ColourTell(t_colourDisplay, t_colourBack1, t_string);
else if(t_color == "no") world.ColourTell(t_colourFore1, t_colourBack1, t_string);
}

and my trigger is ~(\w*)

i tested it with the "Test Trigger" and it doesn't seem to work, seems like your trigger parser does work if i do something like ~tiI ~diam ~noweird it only get's like the first one ~tiI and will only display I with the desingated number. I even tried options like repeat on same line and keep evaluating but it doesn't seem to to work. and when i send it through a note/tell like world.Tell("~tiI") the trigger parser doesn't catch it which really sucks.... so it would be useless because that was the whole point...
Top

Posted by Faolong   USA  (28 posts)  Bio
Date Reply #5 on Tue 22 Oct 2002 05:11 PM (UTC)

Amended on Tue 22 Oct 2002 09:52 PM (UTC) by Nick Gammon

Message

function z(str1, str2) {
	var t_string = str1;
	var regular = /%(d|n|r|s|t)/g;
	var t_color = new Array();
	var counter = 0;
	var t_array = new Array();

	var t_colourFore1 = world.GetVariable("colour_fore1");
	var t_colourFore2 = world.GetVariable("colour_fore2");
	var t_colourDisplay = world.GetVariable("colour_display");
	var t_colourBack1 = world.GetVariable("colour_back1");
	var t_colourReceive = world.GetVariable("colour_receive");
	var t_colourSend = world.GetVariable("colour_send");
	
	while ((t_color = regular.exec(t_string)) != null) {
		t_array[counter] = t_color.index;
		t_array[counter + 1] = t_color.lastIndex;
		t_array[counter + 2] = t_color[1];
		counter += 3;
	}
	
	if(str2 == null) zb();
	if(t_array[0] == null) world.ColourTell(t_colourFore1, t_colourBack1, str1);
	else {
		if(t_array[0] != "0") world.ColourTell(t_colourFore1, t_colourBack1, t_string.substring(0, t_array[0]));
		for(var k = 0; k <= counter; k += 3) {
			if(t_array[k + 3]) {
				if(t_array[k + 2] == "d") world.ColourTell(t_colourDisplay, t_colourBack1, t_string.substring(t_array[k + 1], t_array[k + 3]));
				else if(t_array[k + 2] == "n") world.ColourTell(t_colourFore1, t_colourBack1, t_string.substring(t_array[k + 1], t_array[k + 3]));
				else if (t_array[k + 2] == "r") world.ColourTell(t_colourReceive, t_colourBack1, t_string.substring(t_array[k + 1], t_array[k + 3]));
				else if (t_array[k + 2] == "s") world.ColourTell(t_colourSend, t_colourBack1, t_string.substring(t_array[k + 1], t_array[k + 3]));
				else if (t_array[k + 2] == "t") world.ColourTell(t_colourFore2, t_colourBack1, t_string.substring(t_array[k + 1], t_array[k + 3]));
			}
			else {
				if(t_array[k + 2] == "d") world.ColourTell(t_colourDisplay, t_colourBack1, t_string.substr(t_array[k + 1]));
				else if(t_array[k + 2] == "n") world.ColourTell(t_colourFore1, t_colourBack1, t_string.substr(t_array[k + 1]));
				else if (t_array[k + 2] == "r") world.ColourTell(t_colourReceive, t_colourBack1, t_string.substr(t_array[k + 1]));
				else if (t_array[k + 2] == "s") world.ColourTell(t_colourSend, t_colourBack1, t_string.substr(t_array[k + 1]));
				else if (t_array[k + 2] == "t") world.ColourTell(t_colourFore2, t_colourBack1, t_string.substr(t_array[k + 1]));
			}
		}
	}
	if(str2 == null) world.ColourTell(t_colourDisplay, t_colourBack1, "\n");
}


i think this solved my whole color script stuff...

Edited by Nick to add [code] to make it more readable.
Top

Posted by Nick Gammon   Australia  (23,133 posts)  Bio   Forum Administrator
Date Reply #6 on Wed 23 Oct 2002 02:45 AM (UTC)

Amended on Wed 23 Oct 2002 05:20 AM (UTC) by Nick Gammon

Message

I was thinking of something along the lines of a plugin I just wrote. See Sending coloured text to the world window with ease

Once you have this function you can do things like this:

ColourNote "~R red ~G green ~B blue ~RY red-on-yellow"


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


20,147 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.