Hard Light Productions Forums
FreeSpace Releases => Scripting Releases => Topic started by: Axem on September 16, 2012, 05:23:15 pm
-
Oh great and powerful script gods, I come to you for your assistance.
I would like a lua script that automagically lists and displays all sexp variables and their names.
Now I can do this manually with sexps themselves but I can be known to... use a lot of sexp variables... So if there were a way to quickly and easily turn a complete sexp variable list on and off, that would be awesome. Ideally it would be a list that starts from the top and goes down.
As payment, I am willing to give you adorable pictures of cats.
-
oooh kitties!
im abit rusty but do something like this on each frame. im not sure if im converting things to strings correctly and ive probibly misspelled things.
#Conditional Hooks
$Application: FS2_Open
$State: GS_STATE_GAME_PLAY
$On Frame: [
--tweakables!
printSexpVars = true
posX,posY = 10,50
--print stuffs
if printSexpVars then
gr.drawString("Sexp Var Name: Value, Type, Persistence", posX, posY )
for i=1, #mn.SEXPVariablesdo
local var = mn.SEXPVariables[i]
if var:isValid() then
gr.drawString( tostring(var)..": "..tostring(var.Value)..", "..tostring(var.Type)..", "..tostring(var.Persistence) )
end
end
end
]
#end
-
Oh hey, I didn't think anyone would actually reply!
Anyway I get this error
LUA ERROR: [string "sexpvar-sct.tbm - On Frame"]:7: ')' expected near 'posX'
-
Let me try to correct that by inserting some spaces and stuff:
#Conditional Hooks
$Application: FS2_Open
$State: GS_STATE_GAME_PLAY
$On Frame: [
--tweakables!
printSexpVars = true
posX,posY = 10,50
--print stuffs
if printSexpVars then
gr.drawString("Sexp Var Name: Value, Type, Persistence", posX, posY )
for i=1, #mn.SEXPVariables do
local var = mn.SEXPVariables[i]
if var:isValid() then
gr.drawString( tostring(var)..": "..tostring(var.Value)..", "..tostring(var.Type)..", "..tostring(var.Persistence) )
end
end
end
]
#end
This one works for me so have fun getting half of your screen filled up with text :P
You can remove the var.Type and var.Persistance parts and modify the displaying position (posX, posY) to fix that.
-
Payment as promised.
(http://25.media.tumblr.com/tumblr_m7oo1k2ZYW1qahxmso1_500.jpg)
This is exactly what I wanted. The only thing that would make it better is being able to turn it on and off, with a script-eval maybe? That would solicit a cat video then!
(Also more like the ENTIRE screen of variables)
-
awww kitty!
i derped and forgot a comma.
im actually supprised it worked, i just typed it into the message and didnt test it.
-
With Admiral MS' help...
Toggle it on/off with 'Alt-2'.
#Conditional Hooks
$Application: FS2_Open
$State: GS_STATE_GAME_PLAY
$On Frame:
[
--tweakables!
posX,posY = 10,50
--print stuffs
if printSexpVars then
gr.drawString("Sexp Var Name: Value, Type, Persistence", posX, posY )
for i=1, #mn.SEXPVariables do
local var = mn.SEXPVariables[i]
if var:isValid() then
gr.drawString( tostring(var)..": "..tostring(var.Value)..", "..tostring(var.Type)..", "..tostring(var.Persistence) )
end
end
end
]
$Application: FS2_Open
$On Gameplay Start:
[
printSexpVars = false
]
$State: GS_STATE_GAME_PLAY
$On Key Pressed:
[
if hv.Key == "Alt-2" then
if printSexpVars then
printSexpVars = false
elseif not printSexpVars then
printSexpVars = true
end
end
]
#end