LibSL - The ruby SecondLife client framework
LibSL is a framework for building SecondLife client applications in ruby. The most basic client application can be written in three lines of ruby code:
require 'libsl'
setup "firstname", "lastname", "password"
when_ready { shutdown }
This simple example will login to SecondLife and shutdown once we are connected. LibSL is all about interacting with the SecondLife servers. The DSL makes this very easy. Handle events:
# Handle one specific event
handle :event_name do |type, *args|
# do something
end
# Handle multiple events
handle [:event1, :event2] do |type, *args|
# do something
end
# Handle all events
handle :all do |type, *args|
# do something
end
Use the client API to interact with the SecondLife world:
# Send a chat message
client.agent_manager.chat("Hello!")
# Send an instant message
client.agent_manager.im("Hello!", uuid)
Or build raw packets and send them to the server:
# Request money balance
packet = MoneyBalanceRequestPacket.new({
:AgentData => {
:AgentID => client.network_manager.agent_id,
:SessionID => client.network_manager.session_id
},
:MoneyData => {
:TransactionID => LLUUID.null
}
})
send_packet packet