Stupid Question
by Brett Bowen · in Torque Game Engine · 08/28/2001 (7:20 pm) · 20 replies
Scripts are they supposed to compile at run time or what? I am adding some weapon code, just dropping it right in the client/scripts folder. In the console it just tells me that it could not find the 3 files and lists them. Now is it trying to load the compiled files? or is it the straight .cs file its looking for.
If it is the .cs file, why would it tell me the file is missing when I know its there.
thanks for the info.
If it is the .cs file, why would it tell me the file is missing when I know its there.
thanks for the info.
About the author
#2
08/28/2001 (7:48 pm)
yup checked that twice, I've given the full path and that still does not work. Is there something special I need to do that I am just not seing?
#3
I believe it checks the date/time of the .cs.dso compiled version to the .cs source version and [re]compiles if necessary.
If it returns a can't locate script error, then a path or typing mistake is most likely the cause.
David
08/28/2001 (8:08 pm)
Hi,I believe it checks the date/time of the .cs.dso compiled version to the .cs source version and [re]compiles if necessary.
If it returns a can't locate script error, then a path or typing mistake is most likely the cause.
David
#4
08/28/2001 (8:27 pm)
Ah that helps me :) I have a question too, I'm stil; a newbie with the v12 and when I try doing stuff inconsole, I get "Syntax error in input" did u forget to do something when compiling. It sounds so easy, but I can't seem to figure it out :)
#5
By "full path" are you referring to the absolute versus the relative path?
I believe the engine (compiled exe) expects paths relative to itself.
So referencing scripts in the clients/scripts folder would be as "clients/scripts/thescript.cs".
Matt:
Depends on the command...
Some of the engine commands are not fully implemented, and script functions are called in a c-style syntax, ie: "function(parameters);"
David
08/29/2001 (1:56 am)
Brett:By "full path" are you referring to the absolute versus the relative path?
I believe the engine (compiled exe) expects paths relative to itself.
So referencing scripts in the clients/scripts folder would be as "clients/scripts/thescript.cs".
Matt:
Depends on the command...
Some of the engine commands are not fully implemented, and script functions are called in a c-style syntax, ie: "function(parameters);"
David
#6
exec("/cleint/scripts/item.cs");
exec("/client/scripts/weapons.cs");
exec("/client/scripts/pistol.cs");
The very first time I tried things I put the exec commands in client/main.cs and gave the exec commands as
exec("~/scripts/item.cs");
exec("~/scripts/weapons.cs");
exec("~/scripts/pistol.cs");
any thoughts or obvious errors??? I would figure that the last one would be correct because that file is exec'ing other scripts from the same dir so why wouldn't it find these files???
08/29/2001 (5:22 am)
I have given both. Right now until i reorganize things in the dir I put the exec commands in the server/scritps/player.cs file. Then I give the exec command as follows. exec("/cleint/scripts/item.cs");
exec("/client/scripts/weapons.cs");
exec("/client/scripts/pistol.cs");
The very first time I tried things I put the exec commands in client/main.cs and gave the exec commands as
exec("~/scripts/item.cs");
exec("~/scripts/weapons.cs");
exec("~/scripts/pistol.cs");
any thoughts or obvious errors??? I would figure that the last one would be correct because that file is exec'ing other scripts from the same dir so why wouldn't it find these files???
#7
That would cause things to not work...
Also the tilde implies current directory (kindof)
so the tilde in the bottom commands becomes client/ (the folder the script that called those commands is in) which works since it was called from client/main.cs
If that was in a script in the base folder however, it wouldn't be able to find the scripts and you'd need to call client/scripts/item.cs (which is less error prone anyway)
-nohbdy
08/29/2001 (6:04 am)
One thing is when you're putting any path you should never use a leading slash (like in your exec("/client/scripts/...) commands)That would cause things to not work...
Also the tilde implies current directory (kindof)
so the tilde in the bottom commands becomes client/ (the folder the script that called those commands is in) which works since it was called from client/main.cs
If that was in a script in the base folder however, it wouldn't be able to find the scripts and you'd need to call client/scripts/item.cs (which is less error prone anyway)
-nohbdy
#8
the bottom commands do not work, still tells me that its a missing file. That's what I thought was so wierd because that file is execing scripts from that same directory but when it gets to my files it can't find them.
08/29/2001 (6:16 am)
took the leading / out and still nothing. still tells me its not found. Do I have to notify the system some how that those files are there or that they need to be compiled?the bottom commands do not work, still tells me that its a missing file. That's what I thought was so wierd because that file is execing scripts from that same directory but when it gets to my files it can't find them.
#9
by the way, what I said about the tilde being current directory... it's not =p i was wrong
just throw a bunch of exec("..."); commands into the console until you get your script to run, you're bound to get it to work eventually.. then take the command that worked and throw it into client/main.cs or something
-nohbdy
08/29/2001 (7:52 am)
hmm.. don't really know what's wrong then... sounds like something I'd just mess with until it works unfortunately I can't do that for you =) sorryby the way, what I said about the tilde being current directory... it's not =p i was wrong
just throw a bunch of exec("..."); commands into the console until you get your script to run, you're bound to get it to work eventually.. then take the command that worked and throw it into client/main.cs or something
-nohbdy
#10
I think I am going to reorganize the dir the way I want it then see what I can get done.
p.s. don't know if this clues anyone in or not, but I have been able to modify existing files and have the results come up the way they are supposed to. For example my game is a little more real so a player just can't walk up a 80 degree incline, so I knocked it down and it works fine. Its just adding the new scripts is when it screws up.
08/29/2001 (8:30 am)
yeah looks like that is what I am going to have to do, I just don't like that whole trial and error thing. takes way too long and its like taking a shot in the dark which is what I have been doing anyway but still. ;) I think I am going to reorganize the dir the way I want it then see what I can get done.
p.s. don't know if this clues anyone in or not, but I have been able to modify existing files and have the results come up the way they are supposed to. For example my game is a little more real so a player just can't walk up a 80 degree incline, so I knocked it down and it works fine. Its just adding the new scripts is when it screws up.
#11
08/29/2001 (12:38 pm)
The ~/ stands for the current mod directory so if you are in the server mod dir then ~/ will be replaced with server/ (i.e. exec("~/scripts/audio.cs"); is the same as exec("server/scripts/audio.cs"); ) This allows you to not have to worry about the directory name that people are putting your mod into as long as they keep the right directory structure. If you access something outside of the current mod directory you will have to use it's full path from the example root (e.g. exec("data/shapes/player/player.cs"); is called from player.cs in the server/scripts). However, I know the vehicle shape loading code (shapeFile = "data/shapes/player/vehicle_grav_scout.dts";) doesn't use the ~/ correctly and I think that the player shape loading code is also broken (I want to test it again to make sure). I'm sure there are some other places in the code that doesn't respond correctly to ~/ but they will be found and corrected =)
#12
I have noticed that virtually every exec function I have seen has both a path and at least one boolean following it exec (" somepath/ascript.cs", true); I assumed that the booleans being passed were for the scripts being executed but does the 'exec' function itself also have a boolean requirement?
08/29/2001 (7:34 pm)
Just an observation. I have noticed that virtually every exec function I have seen has both a path and at least one boolean following it exec (" somepath/ascript.cs", true); I assumed that the booleans being passed were for the scripts being executed but does the 'exec' function itself also have a boolean requirement?
#13
See we all knew all along that it was something stupid. ;)
08/29/2001 (8:06 pm)
Figured out what was going on. When I created a new file, it created as a txt file, not as a .cs file, so when I renamed it to filename.cs it really didn't rename it that. duh. See we all knew all along that it was something stupid. ;)
#14
08/29/2001 (8:27 pm)
Not stupid on your part. Stupid on Windows part. One of the reasons I turned on "always show extension" If I want to rename a file I'm likely to change the extension too... so you might as well show it to me when I change it
#15
Has anyone thought of making a script compiler/editor??? I think that would be really useful instead of having to write the script in a text editor then going to the console finding out you made a typo then going back fixing it, go to the console again find out you made another mistake, you get the picture.
I would be glad to look into this if someone wants to point me to the direction of the things I would need.
08/30/2001 (6:17 am)
yeah tell me about it, I was wracking my brain to figure out what was going on, then I just happen to notice that the file type still said txt. Has anyone thought of making a script compiler/editor??? I think that would be really useful instead of having to write the script in a text editor then going to the console finding out you made a typo then going back fixing it, go to the console again find out you made another mistake, you get the picture.
I would be glad to look into this if someone wants to point me to the direction of the things I would need.
#16
Tribal IDE
-nohbdy
08/30/2001 (8:56 am)
Dave Dunscombe made a great little program called Tribal IDE that can be used for editing .cs and .gui file editing.. it has syntax highlighting, multiple file support, and can be setup to do debugging too though I've never tried to get that to work yetTribal IDE
-nohbdy
#17
08/30/2001 (10:32 am)
Hmm... Making a standalone compiler is a possibility at this point since we have the source code to the compiler that the game engine uses.
#18
I can just here the wife now, "you're taking on ANOTHER project!!"
;) hehehe
08/30/2001 (11:24 am)
I looked at that Tribal IDE its neat, but in order to do any compiling looks like you have to connect to the debug server. Maybe if I get some free time (heh) I'll dust off my MFC skillz (no one yell) and see what I can come up with. Might take me a while since I have a lot of projects going right now. I can just here the wife now, "you're taking on ANOTHER project!!"
;) hehehe
#19
Plus the feature set of the editor is second-to-none with things such as split, block edit, and find-in-files search...
The script language and engine help could even be located on-line in DevStudio.
Not sure if this is easy to do (haven't checked if it's even possible!), but the DevStudio is used for many of MS's languages in the VS suite.
FYI: I mentioned VS5 [97] only because that's what I'm currently running until I get VSEnterprise6 in this fall's budget [next month] -- so no V12 C++ editing yet -- waahh! But it is giving me time to get the graphics and scripting completed.
David
08/30/2001 (11:41 am)
Although it sort-of goes against cross-platform, it sure would be great if a script compiler could be an extension of the Visual Studio 5/6 Developer Studio editor -- then I could edit the C++ and Scripts all on one editor.Plus the feature set of the editor is second-to-none with things such as split, block edit, and find-in-files search...
The script language and engine help could even be located on-line in DevStudio.
Not sure if this is easy to do (haven't checked if it's even possible!), but the DevStudio is used for many of MS's languages in the VS suite.
FYI: I mentioned VS5 [97] only because that's what I'm currently running until I get VSEnterprise6 in this fall's budget [next month] -- so no V12 C++ editing yet -- waahh! But it is giving me time to get the graphics and scripting completed.
David
#20
09/01/2001 (5:04 am)
Well I looked at Tribal IDE, its very useful. I know it doesn't help those non windows users out there but for the most of us it gets the job done. Its real easy set up and to get the debugging to work is not that bad. At first its a little hard to get started but its not bad. Every once in a while a few files will come back saying its not a valid script file. (WTF) you have to exit out of the console and the ide come back in compile again and its fine. I would suggest it to anyone, its not a fully integrated compiler, but once you get the console up and set the debug parameters you don't have to mess with teh console the ide does it all for you. so its kind of cool. Anyway thought I would let you know that.
Torque Owner Josh Albrecht