Deprecated: Assigning the return value of new by reference is deprecated in /var/www/siebn.de/wiki/inc/parserutils.php on line 205

Deprecated: Assigning the return value of new by reference is deprecated in /var/www/siebn.de/wiki/inc/parserutils.php on line 208

Deprecated: Assigning the return value of new by reference is deprecated in /var/www/siebn.de/wiki/inc/parserutils.php on line 389

Deprecated: Assigning the return value of new by reference is deprecated in /var/www/siebn.de/wiki/inc/parserutils.php on line 530

Deprecated: Function split() is deprecated in /var/www/siebn.de/wiki/inc/auth.php on line 154
bs2_codinghelp_message [Burning Sand Wiki]
Warning: date() [function.date]: It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected 'Europe/Berlin' for 'CET/1.0/no DST' instead in /var/www/siebn.de/wiki/inc/template.php on line 242
 

Deprecated: Assigning the return value of new by reference is deprecated in /var/www/siebn.de/wiki/inc/parser/parser.php on line 66

Deprecated: Assigning the return value of new by reference is deprecated in /var/www/siebn.de/wiki/inc/parser/lexer.php on line 292

Deprecated: Assigning the return value of new by reference is deprecated in /var/www/siebn.de/wiki/inc/parser/handler.php on line 22

Deprecated: Assigning the return value of new by reference is deprecated in /var/www/siebn.de/wiki/inc/parser/handler.php on line 49

Deprecated: Assigning the return value of new by reference is deprecated in /var/www/siebn.de/wiki/inc/parser/handler.php on line 213

Deprecated: Assigning the return value of new by reference is deprecated in /var/www/siebn.de/wiki/inc/parser/handler.php on line 241

Deprecated: Assigning the return value of new by reference is deprecated in /var/www/siebn.de/wiki/inc/parser/handler.php on line 295

Deprecated: Assigning the return value of new by reference is deprecated in /var/www/siebn.de/wiki/inc/parser/handler.php on line 328

Deprecated: Assigning the return value of new by reference is deprecated in /var/www/siebn.de/wiki/inc/parser/handler.php on line 575

Deprecated: Function split() is deprecated in /var/www/siebn.de/wiki/inc/parser/metadata.php on line 289

Deprecated: Function split() is deprecated in /var/www/siebn.de/wiki/inc/parser/metadata.php on line 289

Deprecated: Assigning the return value of new by reference is deprecated in /var/www/siebn.de/wiki/inc/parser/xhtml.php on line 939

Help Main Menu

Lots of people ask how the MESSAGE function work. I'll try to demonstrate in wich way it could be usefull.

The MESSAGE command

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 CLEAR: will clear the current message.
  • MESSAGE SEND: will send the message to the console log. The log is in BS2 and in the console.txt file when BS2 close.
  • MESSAGE SENDTEXT: will send what you input after the command to the console log.
MESSAGE SENDTEXT "This text will be sent to the console"
  • MESSAGE SAVE: will save the current message to an already opened file. See the file section for this.
  • MESSAGE EXEC: will execute any code contained in the current message. If it contain error, those errors will be in the console log.

Example

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:

  1. MESSAGE = “Element Shader ShaderElement”
  2. MESSAGE = “Element Shader ShaderElement0” This give a unique name at our element.
  3. MESSAGE = “Element Shader ShaderElement0 ” This just to add a space, not a big text, but very important.
  4. MESSAGE = “Element Shader ShaderElement0 0” This is for the red color, we want it to increment, like the 'tmp' variable.
  5. MESSAGE = “Element Shader ShaderElement0 0 1 1 1 0 Clear ” These are default value for a solid element.
  6. MESSAGE = “Element Shader ShaderElement0 0 1 1 1 0 Clear 0” This is for the order in the menu.
  7. MESSAGE = “Element Shader ShaderElement0 0 1 1 1 0 Clear 0 TEXT Shader”
  8. MESSAGE = “Element Shader ShaderElement0 0 1 1 1 0 Clear 0 TEXT Shader0” What will appear in the menu.

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

Networking

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.

BS1 Message Command

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?

 

Warning: date() [function.date]: It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected 'Europe/Berlin' for 'CET/1.0/no DST' instead in /var/www/siebn.de/wiki/inc/template.php on line 785
bs2_codinghelp_message.txt · Last modified: 2008/08/08 14:19 (external edit)
 
Recent changes RSS feed Creative Commons License Donate Powered by PHP Valid XHTML 1.0 Valid CSS Driven by DokuWiki