Script Bindings Progress
Posted: 15 Nov 2005, 07:25
Some of you may know i have been working on some scripting bindings for TMW server, and as requested by an individual I will post an update on the forums
Currently you are able to create Ruby scripts which provide some basic functionality for the server. Many of the reasons that some things are not hugely functional is because the feature has not been totally implemented with the server. The only part which is fully usable via Ruby scripts are "message handlers", which allows you to redefine and extend the server's protocol.
Here is a small example:
This small script will override the default action which is taken when a client tries to equip an item.
Now i will be working on making everything work nicely and interact in the game world, and providing support for scripted enemies & items.
Currently you are able to create Ruby scripts which provide some basic functionality for the server. Many of the reasons that some things are not hugely functional is because the feature has not been totally implemented with the server. The only part which is fully usable via Ruby scripts are "message handlers", which allows you to redefine and extend the server's protocol.
Here is a small example:
Code: Select all
class EquipHandler < Tmw::MessageHandler
def initialize()
super
end
def receiveMessage(computer, message)
print "Message ID: ", message.getId(), "\n"
item = message.readLong()
slot = message.readByte()
print "Trying to equip ", item, " at ", slot.to_i(), "\n"
result = Tmw::MessageOut.new()
result.writeShort(Tmw::SMSG_EQUIP_RESPONSE)
result.writeByte(Tmw::EQUIP_OK)
computer.send(result.getPacket())
end
end
Tmw::connectionHandler.registerHandler(Tmw::CMSG_EQUIP, EquipHandler.new())
Now i will be working on making everything work nicely and interact in the game world, and providing support for scripted enemies & items.