Fixed some issues with the @script command.
This commit is contained in:
parent
bab89b191b
commit
c8d2e3d6a2
2 changed files with 13 additions and 14 deletions
|
|
@ -25,7 +25,7 @@ class BodyFunctions(Script):
|
||||||
self.interval = 20 # seconds
|
self.interval = 20 # seconds
|
||||||
#self.repeats = 5 # repeat only a certain number of times
|
#self.repeats = 5 # repeat only a certain number of times
|
||||||
self.start_delay = True # wait self.interval until first call
|
self.start_delay = True # wait self.interval until first call
|
||||||
#self.persistent = True
|
self.persistent = True
|
||||||
|
|
||||||
def at_repeat(self):
|
def at_repeat(self):
|
||||||
"""
|
"""
|
||||||
|
|
|
||||||
|
|
@ -1827,16 +1827,15 @@ class CmdScript(MuxCommand):
|
||||||
@script[/switch] <obj> [= <script.path or scriptkey>]
|
@script[/switch] <obj> [= <script.path or scriptkey>]
|
||||||
|
|
||||||
Switches:
|
Switches:
|
||||||
start - start a previously added script
|
start - start all non-running scripts on object, or a given script only
|
||||||
stop - stop a previously added script
|
stop - stop all scripts on objects, or a given script only
|
||||||
|
|
||||||
Attaches the given script to the object and starts it. Script path
|
If no script path/key is given, lists all scripts active on the given
|
||||||
can be given from the base location for scripts as given in
|
object.
|
||||||
settings. If stopping/starting an already existing script, the
|
Script path can be given from the base location for scripts as given in
|
||||||
script's key can be given instead (if giving a path, *all* scripts
|
settings. If adding a new script, it will be started automatically (no /start
|
||||||
with this path on <obj> will be affected). If no script name is given,
|
switch is needed). Using the /start or /stop switches on an object without
|
||||||
all scripts on the object is affected (or displayed if no start/stop
|
specifying a script key/path will start/stop ALL scripts on the object.
|
||||||
switch is set).
|
|
||||||
"""
|
"""
|
||||||
|
|
||||||
key = "@script"
|
key = "@script"
|
||||||
|
|
@ -1870,10 +1869,10 @@ class CmdScript(MuxCommand):
|
||||||
string += format_script_list(scripts)
|
string += format_script_list(scripts)
|
||||||
elif "start" in self.switches:
|
elif "start" in self.switches:
|
||||||
num = sum([obj.scripts.start(script.key) for script in scripts])
|
num = sum([obj.scripts.start(script.key) for script in scripts])
|
||||||
string += "%s scripts started on %s." % num
|
string += "%s scripts started on %s." % (num, obj.key)
|
||||||
elif "stop" in self.switches:
|
elif "stop" in self.switches:
|
||||||
for script in scripts:
|
for script in scripts:
|
||||||
string += "Stopping script %s." % script.key
|
string += "Stopping script %s on %s." % (script.key, obj.key)
|
||||||
script.stop()
|
script.stop()
|
||||||
string = string.strip()
|
string = string.strip()
|
||||||
obj.scripts.validate()
|
obj.scripts.validate()
|
||||||
|
|
@ -1882,9 +1881,9 @@ class CmdScript(MuxCommand):
|
||||||
# adding a new script, and starting it
|
# adding a new script, and starting it
|
||||||
ok = obj.scripts.add(self.rhs, autostart=True)
|
ok = obj.scripts.add(self.rhs, autostart=True)
|
||||||
if not ok:
|
if not ok:
|
||||||
string += "\nScript %s could not be added and/or started." % self.rhs
|
string += "\nScript %s could not be added and/or started on %s." % (self.rhs, obj.key)
|
||||||
else:
|
else:
|
||||||
string = "Script successfully added and started."
|
string = "Script {w%s{n successfully added and started on %s." % (self.rhs, obj.key)
|
||||||
|
|
||||||
else:
|
else:
|
||||||
paths = [self.rhs] + ["%s.%s" % (prefix, self.rhs)
|
paths = [self.rhs] + ["%s.%s" % (prefix, self.rhs)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue