Reload script/plugin/addon question

Please post any questions about developing your plugin here. Please use the search function before posting!
Tuck
Global Moderator
Posts: 205
Joined: Sat Jul 14, 2012 9:35 pm
Location: Copenhagen

Reload script/plugin/addon question

Postby Tuck » Tue Dec 18, 2012 8:45 pm

Would it be possible to create a script that could reload it self?

or would it be safest to create a seperate script, that reloads another ?
-Tuck
User avatar
satoon101
Project Leader
Posts: 2697
Joined: Sat Jul 07, 2012 1:59 am

Postby satoon101 » Tue Dec 18, 2012 10:44 pm

I'm really not sure why you would want a script that reloaded itself. That makes no sense to me. Could you explain why you would want such a script?

This "should" work fine, though, if you really want to do that (be sure to replace <scriptname> with the name of your script):

Syntax: Select all

from core import GameEngine

def reload_script():
GameEngine.ServerCommand('sp reload <scriptname>\n')
Satoon
Tuck
Global Moderator
Posts: 205
Joined: Sat Jul 14, 2012 9:35 pm
Location: Copenhagen

Postby Tuck » Wed Dec 19, 2012 3:41 am

satoon101 wrote:I'm really not sure why you would want a script that reloaded itself. That makes no sense to me. Could you explain why you would want such a script?

This "should" work fine, though, if you really want to do that (be sure to replace <scriptname> with the name of your script):

Syntax: Select all

from core import GameEngine

def reload_script():
GameEngine.ServerCommand('sp reload <scriptname>\n')
Satoon


basicly for maintaince to load new changes and then i was thinking of a command for devs to reload it
-Tuck
User avatar
satoon101
Project Leader
Posts: 2697
Joined: Sat Jul 07, 2012 1:59 am

Postby satoon101 » Wed Dec 19, 2012 4:09 am

New changes to what? The script itself? If that is the case, why not simply use "sp reload" in the server's console (or obviously use "rcon sp reload" remotely)? If you mean external changes, like updates to a .txt, .ini, or other file type that the script reads, there are "much" better ways than reloading the entire script.

Satoon
Tuck
Global Moderator
Posts: 205
Joined: Sat Jul 14, 2012 9:35 pm
Location: Copenhagen

Postby Tuck » Wed Dec 19, 2012 4:14 am

satoon101 wrote:New changes to what? The script itself? If that is the case, why not simply use "sp reload" in the server's console (or obviously use "rcon sp reload" remotely)? If you mean external changes, like updates to a .txt, .ini, or other file type that the script reads, there are "much" better ways than reloading the entire script.

Satoon


i know but i wanted to create a reload feature without giving rcon access, and it was suppose to reload hole source code :)
-Tuck

Return to “Plugin Development Support”

Who is online

Users browsing this forum: No registered users and 22 guests