simple server status script

Started by edwardthefma, May 19, 2010, 11:03:12 pm

Previous topic - Next topic

edwardthefma

May 19, 2010, 11:03:12 pm Last Edit: May 19, 2010, 11:05:20 pm by edwardthefma
i need a simple server status script that will wright online to a log and wen  the server is started and offline wen it is closed
out
i am the lead dev for the shellium mmorpg project
http://wiki.shellium.org/w/Mmorpg
shellium.org :) free linux shells pm me and i will gladly
help you get 1

nathmatt

May 20, 2010, 08:04:34 am #1 Last Edit: May 20, 2010, 08:58:07 am by nathmatt
 i made an extension but the only way it will work right is if you always use ctrl + c to shut down the server if you just close it it wont run the offline code

you load this the same way as all other extensions

Spoiler: ShowHide
module RMXOS

#------------------------------------------------------------------
# Passes the extension's main module to RMX-OS on the top
# level so it can handle this extension.
# Returns: Module of this extension for update.
#------------------------------------------------------------------
def self.load_current_extension
return Server_States
end

end

#======================================================================
# module ExtensionSkeleton
#======================================================================

module Server_States

# extension version
VERSION = 1.0
# required RMX-OS version
RMXOS_VERSION = 1.11
# whether the server should update this extension in an idividual thread or not
SERVER_THREAD = true

# :::: START Configuration
# - YOUR CONFIGURATION HERE
# :::: END Configuration

#------------------------------------------------------------------
# Initializes the extension (i.e. instantiation of classes).
#------------------------------------------------------------------
def self.initialize
end
#------------------------------------------------------------------
# Calls constant updating on the server.
#------------------------------------------------------------------
def self.main
# while server is running
while RMXOS.server.running
self.server_update
sleep(0.1) # 0.1 seconds pause, decreases server load
end
    file = File.open('server_status.txt', 'wb')
    file.write("Offline\r\n")
    file.close
end
#------------------------------------------------------------------
# Handles the server update.
#------------------------------------------------------------------
def self.server_update
file = File.open('server_status.txt', 'wb')
    file.write("Online\r\n")
    file.close
end
#------------------------------------------------------------------
# Handles updating from a client.
# client - Client instance (from Client.rb)
# Returns: Whether to stop check the message or not.
#------------------------------------------------------------------
def self.client_update(client)
# - YOUR CLIENT MESSAGE CODE HERE
return false
end

end

Join Dead Frontier
Sorry, I will no longer be scripting for RMXP. I may or may not give support for my scripts. I don't have the will to script in RGSS anymore.
My script


G_G

I'm gonna test a few things with PHP and RMX-OS. I think I might be able to pull it off.

edwardthefma

sounds cool XD btw i got my game reg working thru a web sight
i am the lead dev for the shellium mmorpg project
http://wiki.shellium.org/w/Mmorpg
shellium.org :) free linux shells pm me and i will gladly
help you get 1