To send a message in BurningSand 2 you first have to prepare the message. To do so you should at first clear the message using this command:
MESSAGE CLEAR
After that you can begin expanding the message. For example:
MESSAGE ADDTEXT "My favorit number is "
Then the current message will be “My favorit number is ”. Continue by adding a number to the messagen:
MESSAGE ADDNUMBER (3 + 4)
Now the message will be “My favorit number is 7”. Now add a dot:
MESSAGE ADDTEXT "."
Now the message is “My favorit number is 7.”. To send the message use
MESSAGE SEND
Look at the console. You will se the sentence.
This tutorial requires advanced programming skills. Here i'll explaine how to write a programm that shuts down your computer on TNTExplosion.
If you want to send a message to another programm you first have to know the MESSAGEID of the programm. So after your programm has connected to BS2 you send the following message:
SET SHUTDOWNHANDLER MESSAGEID
After this you can add the following lines into explosions.bs2:
ON TNTexplosion MESSAGE CLEAR ON TNTexplosion MESSAGE ADDTEXT "SHUTDOWN WINDOWS" ON TNTexplosion MESSAGE SEND SHUTDOWNHANDLER
Now listen to every thing you get from BS2. When you recieve the line “SHUTDOWN WINDOWS” simply shutdown windows.
1. REMOVETRIGGER createManyElements 2. ON createManyElements SET tmp 0 3. ON createManyElements WHILE (tmp < 10) createManyElement 4. REMOVETRIGGER writetime 5. ON createManyElement MESSAGE CLEAR 6. ON createManyElement MESSAGE ADDTEXT "Element Clear manyElement" 7. ON createManyElement MESSAGE ADDNUMBER tmp 8. ON createManyElement MESSAGE ADDTEXT " 230 180 0 900 1 1 1 0 Clear 400 TEXT " 9. ON createManyElement MESSAGE ADDNUMBER tmp 10. ON createManyElement MESSAGE EXEC 11. ON createManyElement SET tmp (tmp + 1)
The first time createManyElement is called it creates the following message:
Element Clear manyElement0 230 180 0 900 1 1 1 0 Clear 400 TEXT 0
This message will be executed and the element manyElement0 is being created. The second time createManyElement is called it creates the following message:
Element Clear manyElement1 230 180 0 900 1 1 1 0 Clear 400 TEXT 1
This message will be executed and the element manyElement1 is being created. …