FreeSpace Releases > Scripting Releases

Script Request! - View all Sexp Variables

(1/2) > >>

Axem:
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.

Nuke:
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.


--- Code: ---#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

--- End code ---

Axem:
Oh hey, I didn't think anyone would actually reply!

Anyway I get this error


--- Code: ---LUA ERROR: [string "sexpvar-sct.tbm - On Frame"]:7: ')' expected near 'posX'
--- End code ---

Admiral MS:
Let me try to correct that by inserting some spaces and stuff:


--- Code: ---#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
--- End code ---


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.

Axem:
Payment as promised.



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)

Navigation

[0] Message Index

[#] Next page

Go to full version