Game Development Community

1.5 $runWithEditors ?

by Benjamin L. Grauer · in Torque Game Builder · 08/29/2007 (2:33 pm) · 6 replies

In TGB1.1.3, the variable $runwitheditor was useful to know, in any script if it is the editor .exe or the game .exe that is executed.
But in 1.5, this variable is no more defined. So I can't know if the resources are loaded into the actual game or into the builder.

Is there another way to know ?

#1
08/29/2007 (4:29 pm)
In 1.5 the editor and player is separated into completely separate .exe files and sets of scripts. The editor app is basically the player with editor code and resources included.
#2
08/29/2007 (4:30 pm)
If you create a project and check the copy game executable, your game directory will be created with your game .exe that you can run to operate the game separate of the tools.
#3
08/29/2007 (4:35 pm)
Indeed, but resources (the ones in the game's resources folder) execute themselves without any distinction.
I'd like to put game code in some resources (in a resourceDatabase.cs), but it would be troublesome to execute it also in editor.
#4
08/29/2007 (7:24 pm)
@Benjamin,
This is a cheesy way to do it, but it's what I use to tell if we are runningWithEditors or not. It seems to work over here.
if (isobject(LevelBuilderToolBar))
   $runningWithEditors = true;
else
  $runningWithEditors = false;
#5
08/30/2007 (11:02 am)
Thanks Joe ^^
#6
08/30/2007 (11:43 am)
That's my method too, except I check against
isObject(levelBuilderBase)

probably amounts to exactly the same thing:)

NOTE OF CAUTION:
whatever method you use, be sure to check that it works after a Project>Reload Project call. For some reason, the reload is slightly different than the first load. I had trouble with my resources not working properly after I did a reload project because of this.