View Full Version : LUA version of Remote Text entry 2abc.. 3def
noodleNT
August 12th, 2007, 01:09 PM
I swore I found a LUA script version of this before but I can't find it now. The subject of the thread was like "End to all the SMS questions". Anyway, I am looking for a LUA script option of this to work with MCE when navigating my music library. I tried KeySelector but it doesn't work for Girder 5.
noodleNT
August 13th, 2007, 03:30 PM
I have foudn the code and upated it to work with Girder 4 and Girder 5. All this does is output to the LUA Console for now. Should be a great starting point for other uses.
--################################################## ############################
-- Alphanumeric Input
-- v. 1.0
--
-- Sarmad Mashta, 2004
-- dma, 2005
-- Nick Thoman, 2007
-- LOG:
-- 8/13/2007 - NT - Updated 3.3 code to work with Girder 4 and Girder 5
--################################################## ############################
--[[
Seconds to wait before printing current character without any new key pressed.
--]]
local CharTime = 1.5 * 1000
Event = EventString
Device = EventDevice
--[[
Key reference table.
CHANGE EVENTS AND OUTPUTS ONLY!
You can add more Keys if you want.
--]]
Keys = {}
---- ['EVENT'] = 'Outputs'
Keys['61000000'] = '1:/.@'
Keys['62000000'] = '2abc'
Keys['63000000'] = '3def'
Keys['64000000'] = '4ghi'
Keys['65000000'] = '5jkl'
Keys['66000000'] = '6mno'
Keys['67000000'] = '7pqrs'
Keys['68000000'] = '8tuv'
Keys['69000000'] = '9wxyz'
Keys['60000000'] = '0 '
--STOP!! Go no further!
--Do not change below this line
--Outputs Char after no more inputs
function DoAlphaNum (Char)
LastKey = nil
Index = nil
--Kill active timer
AlphaTimer:Cancel()
--Outputs Char
print("Output:",Char)
end
--Calls function 'DoAlphaNum' to output CurrentChar after the delay timer finishes.
if not AlphaTimer then
AlphaTimer = gir.CreateTimer ( nil, 'DoAlphaNum (CurrentChar)', nil, 0)
else
AlphaTimer:Cancel()
AlphaTimer = gir.CreateTimer ( nil, 'DoAlphaNum (CurrentChar)', nil, 0)
end
AlphaTimer:Arm (CharTime)
if LastKey ~= Event then
if LastKey then
DoAlphaNum (CurrentChar)
end
Index = 1
LastKey = Event
else
Index = Index + 1
if Index > string.len(Keys[Event]) then
Index = 1
end
end
--[[
Shows charactors as you cycle through them in the LUA console.
Might want to use this vaule for MCE input instead since
the delay is already built into it.
--]]
CurrentChar = string.sub(Keys[Event], Index, Index)
print("CurrentChar:",CurrentChar)
noodleNT
August 13th, 2007, 03:37 PM
Here is the sample GML file which is programmed to work with your keyboard number pad.
noodleNT
August 13th, 2007, 07:46 PM
The @ symbol wont pass as a payload. Is there another way to send it? I am using it in the Keyboard event.
noodleNT
August 13th, 2007, 08:45 PM
Figured it out had to pass it as <@>
Mastiff
August 15th, 2007, 08:37 AM
Thanks! Looks very interesting, I gotta check that out this weekend (which is my first chance, I'm in the middle of a crazy work marathon right now)! :)
Mastiff
August 19th, 2007, 03:53 AM
I'm unable to download the Lua file. And with only the previous code put into an scripting action I get an alphatimer error.
Powered by vBulletin® Version 4.1.8 Copyright © 2012 vBulletin Solutions, Inc. All rights reserved.