All it does it say whatever you /say as notification above you and in console.
This was my first script I did to get to understand the dynamics of RR and interacting with game.
Code:
// say.js
// authored by kcd
var ID_PLAYER_TEXT = $.findPacketId("PLAYERTEXT");
var ID_CREATE_SUCCESS = $.findPacketId("CREATE_SUCCESS");
var ID_NOTIFICATION = $.findPacketId("NOTIFICATION");
var player_id = -1;
function onClientPacket(event) {
var packet = event.getPacket();
switch (packet.id()) {
case ID_PLAYER_TEXT: {
var text = packet.text;
if(tex*****ntains("/say ")){
event.cancel();
$.echo(text.substring('/say'.length))
this.displayNotification(event, player_id, 0x00FF00, text.substring('/say'.length));
}
else if(tex*****ntains("/say ")){
}
break;
}
}
}
function onServerPacket(event) {
var packet = event.getPacket();
switch (packet.id()) {
case ID_CREATE_SUCCESS: {
player_id = packet.objectId;
break;
}
}
}
function displayNotification(event, playerObjectId, color, text) {
var notificationPacket = event.createPacket(ID_NOTIFICATION);
notificationPacket.objectId = playerObjectId;
notificationPacket.message = "{\"key\":\"blank\",\"tokens\":{\"data\":\"" + text + "\"}}";
notificationPacke*****lor = color;
event.sendToClient(notificationPacket);
}