CubeScript syntax highlighter
#1
Something we should really have done some time ago...
The php code button on the post editor has now been replaced with a CubeScript button:
[Image: IB8BY.gif]
You can also manually use the [noparse][cubescript][/cubescript][/noparse] tags to the same effect. This will highlight your cubescript keywords in pretty colours, all thanks to Luc4s (and some modification of a nice plugin by CrazyCat)
Example:

[cubescript]// CubeScript placed in this file is automatically executed on each startup.

// "editent" command:
// This command collects all the attributes of the nearest entity, and then
// prompts that into a handy command that allows you to edit that entities
// attributes easily.
// Note: The editent command can NOT define rotation/yaw inside the command!
// However, the current yaw of the player will define the rotation/yaw when
// using the command!
alias editent [
if (strcmp (getenttype) "mapmodel") [
saycommand "/entset" (getenttype) (getentattr 1) (getentattr 2) (getentattr 3)
] [
if (> (findlist "light sound clip plclip" (getenttype)) -1) [
saycommand "/entset" (getenttype) (getentattr 0) (getentattr 1) (getentattr 2) (getentattr 3)
] [
saycommand "/entset" (getenttype) (getentattr ((> (findlist "playerstart ctf-flag" (getenttype)) -1)))
] ] ]

// "convertclips" command:
// This command automatically changes the a "clip" to a "plclip" entity or vice-versa.
alias convertclips [
if (strcmp (getenttype) "clip") [
entset plclip (getentattr 0) (getentattr 1) (getentattr 2) (getentattr 3)
] [
if (strcmp (getenttype) "plclip") [
entset clip (getentattr 0) (getentattr 1) (getentattr 2) (getentattr 3)
] [
echo "No changes made. This entity isn't a clip or a plclip."
echo "Try using the /closestenttype command to find a specific entity."
] ] ][/cubescript]

edit: Also, in order to show the [noparse][cubescript][/noparse] tags in my post, I added the noparse plugin by Ad Bakker, which forces the forum to ignore mycode tags if you put them inside [noparse][noparse][/noparse][/noparse] tags.
Thanks given by:


Messages In This Thread
CubeScript syntax highlighter - by jamz - 30 Oct 11, 03:22PM
RE: CubeScript syntax highlighter - by tempest - 30 Oct 11, 07:48PM
RE: CubeScript syntax highlighter - by Aekom - 31 Oct 11, 12:47AM
RE: CubeScript syntax highlighter - by Orynge - 31 Oct 11, 04:19AM
RE: CubeScript syntax highlighter - by V-Man - 31 Oct 11, 04:14PM
RE: CubeScript syntax highlighter - by Viper - 02 Nov 11, 03:08AM
RE: CubeScript syntax highlighter - by Viper - 03 Nov 11, 01:52AM