world.color tell

Posted by Shadowfyr on Sun 23 Jun 2002 09:19 PM — 8 posts, 20,433 views.

USA #0
Speaking of MXP...

Doing a bit of testing I ran into this. The intent is to return the contents of an invalid tag with a specific color (helpful if debugging so don't rag on me Gammon. lol). The problem is that if you REM the 'world.note sTemp' line and un-REM the world.colortell the colortell appears to disable MXP error checking. i.e. even REMing the offending line and puting the regular note line back to normal doesn't fix it. It appears that the sub is simply never called. Adding an aditional 'world.note " "' after the colortell doesn't fix the problem. Going into and back out of the MXP script settings or I assume turning on/off error checking reenables it, but only as long as you also REM the line causing the problem. This may also be caused by the colornote function, but I haven't tested that.

sub tests (Name, Num1, Num2, Err)
  dim sTest, sTemp
  sTest = "MXP element: "
  'world.note Err
  if InStr(1,Err, sTest,1) = 1 then
    sTemp = "<" & right(Err,len(Err)-13)
    world.note sTemp
    'world.colortell "&h1008000","&h00",sTemp
  end if
end sub


P.S. It might be helpful if you added a link from the MUSHClient forum directly to the built-in script list, since it is a pain trying to look stuff up by going through two other pages to get there.
Australia Forum Administrator #1
Quote:

P.S. It might be helpful if you added a link from the MUSHClient forum directly to the built-in script list, since it is a pain trying to look stuff up by going through two other pages to get there.


I'll answer the easy one first - I have done as you suggested.

Quote:

'world.colortell "&h1008000","&h00",sTemp


There are two problems with this line. :)

  1. The script is "colourtell" (Australian/British spelling of colour) not "colortell". This will cause a script error. When MUSHclient gets a script error it disables the script, so that you don't get the same error message thousands of times in quick succession.
  2. The hex colours should be shown as "#008000" not "&h1008000" (see script page for "colourtell")
Australia Forum Administrator #2
Quote:

This may also be caused by the colornote function, but I haven't tested that.


You mean the "colournote" function?
Canada #3
Quote:

1.The script is "colourtell" (Australian/British spelling of colour) not "colortell".

1.The script is "colourtell" (Australian/British/Canadian spelling of colour) not "colortell".

:)
USA #4
Oh... That's nice... lol But that is even more confusing then.. It should generate an error to the effect that the script I am trying to call doesn't exist or something. Instead other scripts are executing, but the error checking for MXP is disabled. This is still a bug, just not the one I thought it was. lol Hmm. Sadly if the scripting isn't reporting the error it may just be suspending that subs call in a wait-state sort of thing. First time I have heard of some sort of infinite loop, without a loop. lol

Bloody color/colour conventions... Next thing yah know we will was some script function with the dang british 's' in it where we americans use z. :p lol
Australia Forum Administrator #5
Quote:

1.The script is "colourtell" (Australian/British/Canadian spelling of colour) not "colortell".


The list wasn't meant to be exhaustive. :P

You could probably add "New Zealand", or Kalahn might bop me.

Quote:

It should generate an error to the effect that the script I am trying to call doesn't exist or something.


When I tried that I got a dialog box to the effect that the script routine could not be called.
USA #6
>2. The hex colours should be shown as "#008000" not "&h1008000" (see script page for "colourtell")

According to your own docs the color conventions differ from vbscript to javascript as well as perlscript. According to those same docs the &h is the 'correct' convention for vbscript and you also pointed out in another thread as related to an error that using 008000 bugged in vbscript and you had to use 1008000 to make it correctly display such a color.

Needless to say this presents some confusion when trying to use it numerically with some commands and providing it as a string to these new ones. :p You are breaking convention here. While the result is that they may avoid the problem that the other color setting commands have under vscript, it is imho confusing to switch syntax just for these commands. Still.. Nice to know that they won't have the problem I ran into with the other ones.

Anyway.. Very odd that I didn't also get a dialog about not being able to call it. I don't see why it wouldn't, but it just hung the error routine without effecting anything else. Very odd...
Australia Forum Administrator #7
Quote:

According to your own docs the color conventions differ from vbscript to javascript as well as perlscript.


You are confusing a number with a string here. Script routines, like NoteColourRGB, take a number as an argument, and representing colours as numbers, in hex, differ from one language to another. For instance, as a number, the colour "red" could be represented as:

  • Decimal: 255
  • VBscript hex: &hFF
  • Jscript and Perlscript hex: 0xFF


These are all different ways of representing the number 255 in different languages. And yes, in VBscript there was a bug when you tried to use a number with the high-order bit on.

However none of that applies to world.colourtell, because it takes a string argument. The string can be "red", "green", "blue", or if you want to use hex, "#FF0000" (for red). Note two things here:

  • The number is quoted, ie. it is "#FF0000" not #FF0000, thus it is still a string.
  • This is still the representation for red (ie. the red component comes first). Compare this with red in Jscript which is 0x0000FF. You can see these differences in the MUSHclient "colour picker" (Ctrl+Alt+P).


The scripts "colourtell", "colournote" and so on will accept this "pseudo-number" so you can express colours that are not in the list of "alpha" colour names supported by MUSHclient.

For example, "firebrick" is "#B22222", however you might want to change it slightly, to be "#B22223". Since there is no such colour in the MUSHclient colour list, you would have to use the "HTML" version of representing it.