Manual:DIL Manual/SFB MSG
Jump to navigation
Jump to search
SFB_MSG User message
When this flag is set, the routine gets activated when a message is passed to it. Messages can be passed with the DIL commands 'sendto' and 'send':
'activator'... is a unitptr to the unit sending the message. 'argument'.... is a string containing possible data from the sender.
command(CMD_AUTO_MSG) will evaluate to true.
Messages are normally not generated by actions performed by the owner of the program. For a program to be able to be aware of messages from the owner, a keyword 'aware' should be listed just after 'dilbegin'.
When a unit is saved, normally, the DIL programs in it would restart when the program is loaded. However it is possible to let DIL programs recall their execution from where they left off when they where saved. This is done by listing the keyword 'recall' after the 'dilbegin'. This is however a bit limited. Only the status of the original template are saved. Not the state inside a template called as a function or procedure from inside the original template. 'secure' and interrupts are not recalled upon loading the template.
Example:
dilbegin recall aware mute(); var i : integer; code { i:=10; while (i>0) { wait(SFB_CMD,command(CMD_SAY) or command(CMD_SHOUT)); exec("emote tries to make a sound, but only blood spurts through"+ "the lips",self); block; i := i - 1; } i:=10; while (i>0) { wait(SFB_CMD,command(CMD_SAY) or command(CMD_SHOUT)); exec("emote tries to make a sound, but can't",self); block; i := i - 1; } i:=10; while (i>0) { wait(SFB_CMD,command(CMD_SAY) or command(CMD_SHOUT)); exec("emote tries to make a loud sound, but can't",self); block; i := i - 1; } quit; } dilend
/* When attached to a PC, the pc will be unable to utter a sound the first 10 sound command, and blood will spurt out. The next 10 sound commands, the victim just can't shout. The last 10 sound commands only say will work. In the end, 'quit' removes the program all together. The smart thing is that the 'aware' keyword lets the program receive messages from the owner (player) commands. Secondly, the keyword 'recall' makes sure that the program does not start over, if the victim quits in the middle, but restart at the position it had attained. Do not put in the 'aware' if it is not needed. It saves some interpretation time not having to pass the extra messages. */
---~---~---~---~---~---~---~---~---