Author Topic: Script Request! - View all Sexp Variables  (Read 2979 times)

0 Members and 1 Guest are viewing this topic.

Offline Axem

  • 211
Script Request! - View all Sexp Variables
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.

 

Offline Nuke

  • Ka-Boom!
  • 212
  • Mutants Worship Me
Re: Script Request! - View all Sexp Variables
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: [Select]
#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
« Last Edit: September 19, 2012, 06:49:20 pm by Nuke »
I can no longer sit back and allow communist infiltration, communist indoctrination, communist subversion, and the international communist conspiracy to sap and impurify all of our precious bodily fluids.

Nuke's Scripting SVN

 

Offline Axem

  • 211
Re: Script Request! - View all Sexp Variables
Oh hey, I didn't think anyone would actually reply!

Anyway I get this error

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

 
Re: Script Request! - View all Sexp Variables
Let me try to correct that by inserting some spaces and stuff:

Code: [Select]
#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.
Here goes scripting and copy paste coding
Freespace RTS Mod
Checkpoint/Shipsaveload script

 

Offline Axem

  • 211
Re: Script Request! - View all Sexp Variables
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)

 

Offline Nuke

  • Ka-Boom!
  • 212
  • Mutants Worship Me
Re: Script Request! - View all Sexp 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.
« Last Edit: September 19, 2012, 06:54:26 pm by Nuke »
I can no longer sit back and allow communist infiltration, communist indoctrination, communist subversion, and the international communist conspiracy to sap and impurify all of our precious bodily fluids.

Nuke's Scripting SVN

  

Offline mjn.mixael

  • Cutscene Master
  • 212
  • Chopped liver
    • Steam
    • Twitter
Re: Script Request! - View all Sexp Variables
With Admiral MS' help...

Toggle it on/off with 'Alt-2'.

Code: [Select]
#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
Cutscene Upgrade Project - Mainhall Remakes - Between the Ashes
Youtube Channel - P3D Model Box
Between the Ashes is looking for committed testers, PM me for details.
Freespace Upgrade Project See what's happening.