In-Game Script Editor
by Marcus L · 11/18/2010 (10:24 pm) · 44 comments
Tested on: 1.1b3
This resource will add a new tool, the script editor, to the world editor's toolbar. I made this resource because of the time i spend closing and opening T3D, which was extremely time consuming. And even tho I'm able to exec the scripts after i change them in torsion, it is not the optimal solution. Therefore i created the in-game script editor. Just so that's said; atm. this editor is very simple and does not even support undoing yet. This doesn't mean this is useless, it just means you should probably not use it for complex coding (for the time being).
First, start of by downloading this .rar.
Extract it to game/tools.
Then, this is how to install the rest of this resource:
Where it says // Added, it means that the line is added.
Where it says // Removed, it means that the line is removed.
Where it says // Changed, it means that the line is changed.
Where it says ..., it means that there is code between what ever that was last written.
Whenever it says ..., there will be an comment below describing what function it is.
I recommend you using CTRL + F to find where to put the code blocks. Remember to backup before installing.
We'll start by editing core/scripts/client/helperfuncs.cs
Then edit tools/worldEditor/gui/ToolsToolbar.ed.gui
Last, edit tools/worldEditor/scripts/EditorGui.ed.cs
Now just enter any level,
Press F11,
And you'll see a new icon in the toolbar,
Press it,
And you'll have a TextPad window and a FileTree on the side.
You'll now see that you have a Save button, a Close Button and a Refresh button.
The Save button will save any change you've made to the current script.
The Close button will close the TextPad. This can be restored by opening any script. Also note that whenever you're closing the TextPad it'll ask you if you want to save, even tho you've not made any change.
The Refresh button will automatically save you're file and execute it. Note that the save button will not execute.
The FileTree is just like the mesh selector from the Object Editor. It will by default only search for .cs and .gui files. This can be changed in the Edit->Editor Settings... dialog.
Right click->view image for full size (it got cut off).
This resource is actually "Known Issue" free =). But there is a lot of room for improvement. Here is a list for those who want to help me improve this resource:
If you stumble upon some issues, let me know.
Also know that my methods might not be correct, nor the most professional. Therefore if you see some silly mistakes please leave a comment with the "fix".
Thanks,
Marcus L.
This resource will add a new tool, the script editor, to the world editor's toolbar. I made this resource because of the time i spend closing and opening T3D, which was extremely time consuming. And even tho I'm able to exec the scripts after i change them in torsion, it is not the optimal solution. Therefore i created the in-game script editor. Just so that's said; atm. this editor is very simple and does not even support undoing yet. This doesn't mean this is useless, it just means you should probably not use it for complex coding (for the time being).
Installation:
First, start of by downloading this .rar.
Extract it to game/tools.
Then, this is how to install the rest of this resource:
Where it says // Added, it means that the line is added.
Where it says // Removed, it means that the line is removed.
Where it says // Changed, it means that the line is changed.
Where it says ..., it means that there is code between what ever that was last written.
Whenever it says ..., there will be an comment below describing what function it is.
I recommend you using CTRL + F to find where to put the code blocks. Remember to backup before installing.
We'll start by editing core/scripts/client/helperfuncs.cs
// Put below function loadFileText( %file)
// Added ->
function saveFileText( %file, %text )
{
// File Object
%fo = new FileObject();
%fo.OpenForWrite(%file);
// Write Text
%fo.writeLine(%text);
// Clean Up
%fo.delete();
return %text;
}
// Added <-Then edit tools/worldEditor/gui/ToolsToolbar.ed.gui
//In the beginning of the gui
//--- OBJECT WRITE BEGIN ---
%guiContent = new GuiContainer(EWToolsToolbar) {
canSaveDynamicFields = "0";
Enabled = "0";
internalName = "ToolsToolbar";
isContainer = "1";
Profile = "editorMenubarProfile";
HorizSizing = "right";
VertSizing = "bottom";
Position = "0 31";
//MXG: 14 is the number of tools, change if you have more
Extent = (29 + 4) * 14 + 12 SPC "33"; // Changed
MinExtent = "8 2";
canSave = "1";
Visible = "1";
hovertime = "1000";
isClosed = "0";
isDynamic = "0";Last, edit tools/worldEditor/scripts/EditorGui.ed.cs
...
//In function EditorGui::init(%this)
EWInspectorWindow.setVisible( false );
}
}
// Added ->
if( !isObject( %this-->ScriptTreeWindow ) )
{
// Load Creator/Inspector GUI
exec("~/scriptEditor/scriptEditorGui.gui");
if( isObject( EWScriptTreeWindow ) )
{
%this.add( EWScriptTreeWindow );
EWScriptTreeWindow-->EditorTree.selectPage( 0 );
EWScriptTreeWindow.setVisible( false );
}
}
// Added <-
...
//Same
EWorldEditor.init();
ETerrainEditor.init();
//Creator.init();
EWCreatorWindow.init();
EWBrowserWindow.init(); // AddedNow just enter any level,
Press F11,
And you'll see a new icon in the toolbar,
Press it,
And you'll have a TextPad window and a FileTree on the side.
You'll now see that you have a Save button, a Close Button and a Refresh button.
The Save button will save any change you've made to the current script.
The Close button will close the TextPad. This can be restored by opening any script. Also note that whenever you're closing the TextPad it'll ask you if you want to save, even tho you've not made any change.
The Refresh button will automatically save you're file and execute it. Note that the save button will not execute.
The FileTree is just like the mesh selector from the Object Editor. It will by default only search for .cs and .gui files. This can be changed in the Edit->Editor Settings... dialog.
Screenshot:
Right click->view image for full size (it got cut off).This resource is actually "Known Issue" free =). But there is a lot of room for improvement. Here is a list for those who want to help me improve this resource:
- Undoing
- Proper file tree
- Code markup
- File tree right click context menu
- Auto-Complete-Me (IntelliSense)
If you stumble upon some issues, let me know.
Also know that my methods might not be correct, nor the most professional. Therefore if you see some silly mistakes please leave a comment with the "fix".
Thanks,
Marcus L.
#42
02/25/2015 (7:46 pm)
where I can download this? exist a updated version?
#43
https://db.tt/cvOWgTDZ
03/18/2015 (10:49 am)
try here, i uploaded earlier i believe its the same file, i cannot guarantee this file being here longer than a few weeks, dropbox and i have frequent debates over allowable space :phttps://db.tt/cvOWgTDZ
#44
03/18/2015 (2:00 pm)
thanks! 
Torque 3D Owner Walker Twyman
Extent = (29 + 4) * 14 + 12 SPC "33";
to
Extent = (29 + 4) * 15 + 12 SPC "33";
Edit: I take that back. The datablock editor hangs now in a stock T3D project with this installed in it.