| Blockland Forums > Modification Help |
| Scripting Help |
| (1/3) > >> |
| nanoviro:
I am trying to learn to script and understand a few basics. But I was just wandering how I could type a message into the game and have another message come up with a name. For instance: Me: Hello all Bot: Hello if you catch my drift. Thanks in advance |
| otto-san:
To do this, you have to package the funcdion serverCmdMessageSent. --- Code: ---package sillyMsgSentEdit { function serverCmdMessageSent(%client, %text) { if(%text $= "The Game") { messageAll('',"\c3Bot\c6: The game is stupid."); } parent::serverCmdMessageSent(%client, %text); } }; activatePackage(sillyMsgSentEdit); --- End code --- Not sure of this, as I myself have been experimenting with this lately. Another example: --- Code: ---package changethegame { function serverCmdMessageSent(%client, %text) { if(%text $= "the game") { messageAll('',"\c7"@%client.clanPrefix@"\c3"@%client.name@"\c7"@%client.clanSuffix@"\c6: porkchop sandwitches"); } Parent::serverCmdMessageSent(%client, %text); } }; activatepackage(changethegame); --- End code --- I got BSoD while typing this and it restored itself after startup. Wow. |
| nanoviro:
Thank you so much... One issue thou I was using the first one and... The bot commented before me lol |
| Tom:
The reason it's doing that is because the parent was called after the bot message was sent. |
| otto-san:
--- Quote from: Tom on July 13, 2010, 10:08:13 PM ---The reason it's doing that is because the parent was called after the bot message was sent. --- End quote --- i was ninja'd |
| Navigation |
| Message Index |
| Next page |