Log in

View Full Version : When stay X playsound?



Elizabeth
05-19-2017, 06:33 PM
I need script .lua when my character stay 60 second my client play alarm.
This is possible? :)

Trykon
05-20-2017, 04:02 PM
It is possible:

local seconds = 0
local pos = Self.Position()

while true then
if Self.Position().x == pos.x and Self.Position().y == pos.y then
seconds = seconds + 1
if seconds >= 60 then
alert()
end
else
seconds = 0
pos = Self.Position()
end
end

This is not tested and written on the phone so you might want to check it before you run it ;)

Elizabeth
05-25-2017, 01:55 AM
It is possible:

local seconds = 0
local pos = Self.Position()

while true then
if Self.Position().x == pos.x and Self.Position().y == pos.y then
seconds = seconds + 1
if seconds >= 60 then
alert()
end
else
seconds = 0
pos = Self.Position()
end
end

This is not tested and written on the phone so you might want to check it before you run it ;)

Line #: 4
Error: 'do' expected near 'then'

Not work my friend :(

Trykon
05-25-2017, 12:03 PM
local seconds = 0
local pos = Self.Position()

while true do
if Self.Position().x == pos.x and Self.Position().y == pos.y then
seconds = seconds + 1
if seconds >= 60 then
alert()
end
else
seconds = 0
pos = Self.Position()
end
end

Elizabeth

Elizabeth
09-14-2017, 09:49 PM
local seconds = 0
local pos = Self.Position()

while true do
if Self.Position().x == pos.x and Self.Position().y == pos.y then
seconds = seconds + 1
if seconds >= 60 then
alert()
end
else
seconds = 0
pos = Self.Position()
end
end

Elizabeth

Hey, I totaly forgot about this thread :D Today i check this, but still don't work :(
When I add this script alarm play non stop, immediately after switching on.

Trykon
09-15-2017, 11:29 AM
Hey, I totaly forgot about this thread :D Today i check this, but still don't work :(
When I add this script alarm play non stop, immediately after switching on.

If I were you I wouldn't copy my code any time... As most of the time I reply from phone so my code may have typos and so on... I would carefully rewrite it.
Also I have never tested it and actually never tried to write something like this, so this is just rough try.
At the moment I don't see any problem with it.
To be honest I also forgot about this :D

big
09-19-2017, 02:26 PM
local seconds = 0
local pos = Self.Position()

while true do
if Self.Position().x == pos.x and Self.Position().y == pos.y then
seconds = seconds + 1
sleep(1000)
if seconds >= 60 then
alert()
end
else
seconds = 0
pos = Self.Position()
end
end



this should work sleep function was missing :P

Trykon
09-19-2017, 06:48 PM
local seconds = 0
local pos = Self.Position()

while true do
if Self.Position().x == pos.x and Self.Position().y == pos.y then
seconds = seconds + 1
sleep(1000)
if seconds >= 60 then
alert()
end
else
seconds = 0
pos = Self.Position()
end
end



this should work sleep function was missing :P

it might be the case :)

Elizabeth
10-18-2018, 06:10 PM
local seconds = 0
local pos = Self.Position()

while true do
if Self.Position().x == pos.x and Self.Position().y == pos.y then
seconds = seconds + 1
sleep(1000)
if seconds >= 60 then
alert()
end
else
seconds = 0
pos = Self.Position()
end
end



this should work sleep function was missing :P

Yes, now it work! 1 year later, but still needed, thank U Biggy! :D