following on, to get the script to compile ok (for now), I had to comment out some lines that are not yet converted in FPI2LUA, this has still to be done and some other fixes need looking into also. HUDX, HUDY are just the x/y coords where you want to position the sprite/hud.
fading in and out sprites/huds is easy in LUA, I have done another tut video somewhere , I 'll see if I can locate it.
FPI2LUA is still in it's infancy so any FPSC FPI command it can't convert to will just add a function template. you can either write your own function / code or wait till I update the program and not sure when that will be.
--[[ LUA Script converted from FPSC to GameGuru by M.Fowler (c) 2017
Original FPI file can be found under:
C:\Program Files (x86)\The Game Creators\FPS Creator\Files\scriptbank\DungeonItems\switch\switch3_40.fpi
]]
--[[ desc = Use Switch (animated wheel) ]]
state = {} ;
function switch3_40_init(e)
state[e] = 0 ;
end
function switch3_40_main(e)
if state[e] ~=nil then
if state[e] == 0 then
--HUDRESET
HUDX = 50
HUDY = 90
myImage = LoadImage("gamecore\\text\\pressentertouse.tga",1)
HUDNAME = useswitchprompt
HUDHIDE = 1
display = CreateSprite(myImage)
SetSpritePosition(display,HUDX,HUDY)
state[e] = 10
end
if GetPlayerDistance(e) < 40 then
--HUDSHOW = useswitchprompt
--HUDFADEOUT = useswitchprompt
end
if state[e] == 10 and GetPlayerDistance(e) < 40 and g_KeyPressE == 1 then
state[e] = 1
SetAnimation(e,0)
SetAnimationFrame(e,GetEntityAnimationStart(e,0))
--PLRSOUND = $0
ActivateIfUsed(e)
end
if state[e] == 1 then
SetAnimationFrame(e,g_Entity[e]['frame']+1)
end
if state[e] == 1 and g_Entity[e]['frame'] == GetEntityAnimationFinish(e,0) then
state[e] = 2
end
if state[e] == 2 and g_KeyPressE == 0 then
state[e] = 3
end
if state[e] == 3 and GetPlayerDistance(e) < 40 and g_KeyPressE == 1 then
state[e] = 4
--PLRSOUND = $1
ActivateIfUsed(e)
end
if state[e] == 4 then
SetAnimationFrame(e,g_Entity[e]['frame']-1)
end
if state[e] == 4 and g_Entity[e]['frame'] == GetEntityAnimationStart(e,0) then
state[e] = 5
SetAnimation(e,0)
SetAnimationFrame(e,GetEntityAnimationStart(e,0))
end
if state[e] == 5 and g_KeyPressE == 0 then
state[e] = 10
end
PromptLocal (e,'state=' .. state[e] )
end
end
function switch3_40_exit(e)
end
--*** UNCONVERTED FPSC ACTION KEYWORDS ***
--*** END OF UNCONVERTED FPSC ACTION KEYWORDS ***
Professional Programmer: Languages- SAS (Statistical Analysis Software) , C++, C#, VB, SQL, PL-SQL, JavaScript, HTML, Three.js, Darkbasic Pro (still love this language), Purebasic, others
Hardware: Dell Precision 490; AMD Radeon HD 7570; 12GB.