First 2 weapons do not require loading. Attempted to make the mac speak.
This commit is contained in:
parent
ea99b6de12
commit
5442d3843f
@ -1,6 +1,24 @@
|
|||||||
-- Speak with speech-dispatcher
|
-- Store operating system commands in a variable.
|
||||||
|
function os.capture(cmd, raw)
|
||||||
|
local f = assert(io.popen(cmd, 'r'))
|
||||||
|
local s = assert(f:read('*a'))
|
||||||
|
f:close()
|
||||||
|
if raw then
|
||||||
|
return s
|
||||||
|
end
|
||||||
|
s = string.gsub(s, '^%s+', '')
|
||||||
|
s = string.gsub(s, '%s+$', '')
|
||||||
|
s = string.gsub(s, '[\n\r]+', ' ')
|
||||||
|
return s
|
||||||
|
end
|
||||||
|
|
||||||
|
-- Speak with appropriate tool.
|
||||||
local function speak(text)
|
local function speak(text)
|
||||||
|
if os.capture("uname") == "Linux" then
|
||||||
os.execute('spd-say "' .. text .. '"')
|
os.execute('spd-say "' .. text .. '"')
|
||||||
|
else
|
||||||
|
os.execute('say "' .. text .. '"')
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Window related variables.
|
-- Window related variables.
|
||||||
@ -150,6 +168,8 @@ while running do
|
|||||||
weapon = tonumber(keyName)
|
weapon = tonumber(keyName)
|
||||||
if weapon >= 3 then
|
if weapon >= 3 then
|
||||||
loaded = false
|
loaded = false
|
||||||
|
else
|
||||||
|
loaded = true
|
||||||
end
|
end
|
||||||
if weapon == 1 then
|
if weapon == 1 then
|
||||||
speak("pistal")
|
speak("pistal")
|
||||||
|
Loading…
Reference in New Issue
Block a user