Lots of people ask how the MESSAGE function work. I'll try to demonstrate in wich way it could be usefull.
Just think of the MESSAGE command as a variable that you add stuff to it.
These commands let you add stuff to the current message: MESSAGE ADDTEXT: will add a text to the current message.
MESSAGE ADDTEXT "This is some text to add"
MESSAGE ADDNUMBER: will add the content of a variable to the current message.
MESSAGE ADDNUMBER Variable_Name
MESSAGE ADDELEMENT: will add the name of an elementname to the current message.
MESSAGE ADDELEMENT Element
MESSAGE ADDGROUP: will add the name of a group to the current message.
MESSAGE ADDGROUP Group
These commands are for manipulating the content of the message.
MESSAGE SENDTEXT "This text will be sent to the console"
Ok i'll demonstrate the use of the MESSAGE function by creating 256 elements all with a red color that increment.
Normally you would have to write every line 1 by 1, or make one, copy & paste 255 times, then change all desired value 1 by 1.
All those method is a lot of pain to execute, so this is where the MESSAGE function come into play. Again i'll start with a code:
REMOVETRIGGER ShadedElement ON ShadedElement SET tmp 0 ON ShadedElement WHILE (tmp <= 256) ShadedElement2 REMOVETRIGGER ShadedElement2 ON ShadedElement2 MESSAGE CLEAR ON ShadedElement2 MESSAGE ADDTEXT "Element Shader ShaderElement" ON ShadedElement2 MESSAGE ADDNUMBER tmp ON ShadedElement2 MESSAGE ADDTEXT " " ON ShadedElement2 MESSAGE ADDNUMBER tmp ON ShadedElement2 MESSAGE ADDTEXT " 0 1 1 1 0 Clear " ON ShadedElement2 MESSAGE ADDNUMBER tmp ON ShadedElement2 MESSAGE ADDNUMBER " TEXT Shader" ON ShadedElement2 MESSAGE ADDNUMBER tmp ON ShadedElement2 MESSAGE EXEC ON ShadedElement2 SET tmp (tmp + 1)
Now in this example i use the WHILE command to repeat ShadedElement2 256 times.
So the first time ShadedElement2 is executed tmp=0. So lets just make like the MESSAGE command, and add every line:
'tmp' variable.After this, the message function is executed so it will execute this piece of code (the message):
Element Shader ShaderElement0 0 1 1 1 0 Clear 0 TEXT Shader0
Now repeat this process 255 times, incrementing tmp by 1 each time, and you quickly got 256 element going from a red value of 0 to 255.
Element Shader ShaderElement1 1 1 1 1 0 Clear 1 TEXT Shader1 Element Shader ShaderElement2 2 1 1 1 0 Clear 2 TEXT Shader2 ... Element Shader ShaderElement254 254 1 1 1 0 Clear 254 TEXT Shader254 Element Shader ShaderElement255 255 1 1 1 0 Clear 255 TEXT Shader255
So in 15 line you can break BS1 elements limit of 255 !!!
This function is very useful for network function. It let you send any message to a connected client.
I'll explain this later, as it is not completely BS2 related.
For those of you that have searched here to look for the BS1 Message command, you have found it!
The BS1 Message command displays a short message when the user first loads a mod.
Message "Insert message here, no quotes"
Would display a pop-up displaying the following message- Insert message here, no quotes. Easy enough, right?