I'm creating a scheduled task to restart the same three services on different servers. I need the commands to add 10 second pauses between each stop/start.
ex:
sc \Server1 stop "Service1"
-- 10 second pause
sc \Server1 start "Service1"
-- 10 second pause
sc \Server1 stop "Service2"
-- 10 second pause
sc \Server1 start "Service2"
-- 10 second pause
sc \Server2 stop "Service1"
-- 10 second pause
sc \Server2 start "Service1"
-- 10 second pause
sc \Server2 stop "Service2"
-- 10 second pause
sc \Server2 start "Service2"
You are looking for sleep 10.
Related
Is it possible to launch mame with a lua script that would automatically insert coin and press player 1 after a short delay. The launch command would be something like:
mame digdug -autoboot_delay 30 -autoboot_script insert_coin.lua
Basically: launch digdug, ask mame to wait 30 seconds before executing the lua script which would do the insert coin + press player 1 magic.
QUESTION
If this is possible, how would you write the lua script to execute the coin insert and press player one commands.
So, I'm coding this fighting game in roblox studio. Now I have made an NPC, but I want to script it to be able to respawn a few seconds after dead, but I don't know how to check if an NPC is dead or how to respawn one and make it join its body parts again.
Thank you, and I hope you can help.
You can check the health of the NPC from the Health property of its Humanoid in order to see if it's still alive, or if it's dead.
game.workspace.<NPC>.Humanoid.Health
Now in order to check if it's dead, you can do:
if game.workspace.<NPC>.Humanoid.Health <= 0 then
--NPC is dead; respawn
end
In order to 'respawn' the NPC, duplicate the NPC (in workspace) and place the copy in ReplicatedStorage. Now whenever the NPC died, you can replace it with a new one by cloning the one in ReplicatedStorage to workspace:
if game.workspace.<NPC>.Humanoid.Health <= 0 then
wait(2) -- If you want to wait before the NPC respwns, change '2' for the amount of seconds you want to wait
game.ReplicatedStorage.<NPC>:Clone().Parent = game.workspace
end
Finally, wrap this all in a while loop so it can continuously check the health of the NPCs.
while wait() do
if game.workspace.<NPC>.Humanoid.Health <= 0 then
wait(2) -- If you want to wait before the NPC respwns, change '2' for the amount of seconds you want to wait
game.ReplicatedStorage.<NPC>:Clone().Parent = game.workspace
end
end
game.Players.PlayerAdded:Connect(function(player)
game.StarterPlayer.CameraMaxZoomDistance = 0
end)
I want the player to be in first perspective only when they first join the game.
After they die they should be in third person. How do I go about this?
game.Players.PlayerAdded:Connect(function(player)
game.StarterPlayer.CameraMaxZoomDistance = 0
end)
after line 1 and before game.StarterPlayer add a characteraddedfunction like so
player.CharacterAdded:connect(function(character)
character:WaitForChild("Humanoid").Died:connect(function()
game.StarterPlayer.CameraMaxZoomDistance = (number you want for default)
end)
end)
this waits for character to respawn and gets that character and puts it in the character variable, then the game waits for the Humanoid object to appear inside the character, then it waits for the Died event to take place which is the event that watches for a respawn or "death" then it sets the cameradistance back to normal based on the number you put.
I'm using Rosbag to record a F1 robot simulated in Gazebo.
When i record the F1 everything is OK but qhen i use "Rosbag play" the record is not synchronized with the movement of the F1 that i recorded.
The "Bag time" starts in the second 20 but the duration starts in second 0 so the F1 turns early
I've tried with "rosparam set use_sim_time true" and "rosbag play xxxx.bag --clock" but it didn't work.
Any idea?
Thanks!
Presumably, the topics you record publish their first message after 20 seconds. Thus, when the first 20 seconds are empty, rosbag play skips this delay.
Just record more topics which also start to publish at your desired time.
How can I execute an
os.execute("example.exe") with a timeout of 'n' seconds in Lua?
By timeout I mean if 'example.exe' takes more than 'n' seconds to finish execution, it has to be terminated forcibly and lua script must continue executing the statements after os.execute('example.exe').