KeepAreaUp

From HEWIKI
Jump to: navigation, search

KeepAreaUp(area as ID, instance as ID) as Boolean

Arguments

<area> 
The area ID that is being kept up.
<instance> 
The instance that needs to be restarted (often 0 for system areas)

Description

Called only at world server level, and instructs the server to start the specified area server process, and if the area crashes, to immediately restart it. It is used for vital areas that must stay running, such as system areas.

Example

// The below function sends a call to the world server to keep this area up
function KeepUp()
  area as ID = GetAreaNumber()
  instance as ID = GetInstanceNumber()
  rmc as class RemoteCallOut
  rmc.toInstance.AreaID=0
  rmc.toInstance.AreaInstanceNumber=0
  rmc.toScript = SYSTEM.EXEC.THISSCRIPT
  rmc.toFunction = "EnsureStayUp"
  rmc.failScript = SYSTEM.EXEC.THISSCRIPT
  rmc.failFunction = "MyRCFailHandler"
  rmc.args["areaID"] = area
  rmc.args["instanceID"] = instance
  remoteCall(rmc)                 // This makes the remote call to the world server to the
                                  // function "EnsureStayUp"
.
 
remote function EnsureStayUp(rmc as class RemoteCallIn)
  area as ID = rmc.args["areaID"]
  instance as ID = rmc.args["instanceID"]
  if(GetAreaNumber() = 0 and GetInstanceNumber = 0) // Are we at the world level
    KeepAreaUp(area, instance)
  .
.
Personal tools
Namespaces
Variants
Actions
Navigation
Toolbox