Game Development Community

This is confusing

by Taylor Ringo · in Torsion · 11/22/2011 (2:04 pm) · 18 replies

Okay I written a script in VS2008, copied and paste it to Torision, save it as a .cs file in my behaviors folder of Torque Game Builder, then Reloaded the project but when I was foing to edit the bahavior of the player sprite but in the "Behaviors"tab, my scrpit was not there. How do I get it to show up???

About the author

It all started in the 9th grade when i was going to use Platfrom studio, then Game maker, then Xna now I'm with Torque2D


#1
11/22/2011 (2:24 pm)
@Taylor - There is likely some kind of syntax error, which prevents the behavior from loading. There are three ways to check this:

1. Press the tilde key to open the console and look for any red text that shows an error

2. Open the console.log (same directory as TorqueGameBuilder.exe) and look for any errors or warnings

3. Download the Torsion trial and run your project from there. You should immediately get feedback on errors.

If you end up purchasing the engine, your very next purchase should be Torsion because it is the best tool you can have when making a Torque game.
#2
11/22/2011 (2:28 pm)
yup there are a couple of errors
#3
11/22/2011 (2:33 pm)
yeah this was the error when I loaded the game In Torision:
C:/Users/GigaTron/Documents/MyGames/game/game/behaviors/Player_movement.cs Line: 7 - parse error
#4
11/22/2011 (2:34 pm)
Alright, can you paste that line of code or function in this thread so we can look at it?
#5
11/22/2011 (2:36 pm)
C:/Users/GigaTron/Documents/MyGames/game/game/behaviors/Player_movement.cs Line: 7 - parse error
#6
11/22/2011 (2:44 pm)
Need to see the actual code.
#7
11/22/2011 (4:24 pm)
wait which code? my script I wrote or the console log because I cant post anything over 1000 words
#8
11/22/2011 (6:12 pm)
A parse error most often means an error occurred on that line or a preceding line due to a missing parenthesis, bracket, or semi-colon. Though these are only a few of the possibles reasons for a parse error.

Show the code that contains the error. Use the console to find the error so you know what code to show.
#9
11/22/2011 (6:21 pm)
%template.description = "Platformer style movement control";
#10
11/22/2011 (6:24 pm)
Hmm, that looks ok. The problem is either before or after that line of code. Can can post those? Alternatively, you can e-mail me the script. If I find the solution from the e-mail, I will post it here in the forum.
#11
11/22/2011 (6:30 pm)
Yeah, silly script parser sometimes reports the wrong line that is the actual error though it knows if xx line is wrong.
#12
11/22/2011 (6:34 pm)
I really appretiate you guys, I have two questions, 1) do you want me to Post all of my code? secondly @Mike, what is your email address
#13
11/22/2011 (6:38 pm)
@Taylor - Don't worry about posting the full code. Just send the script to michaelp@garagegames.com. I will be able to find the problem quickly and will post the relevant snippets in this thread.
#14
11/22/2011 (6:42 pm)
Just remember in the future when you see parse error that the actual error likely occurs a line or two before/after the stated line#. A syntax error on the other hand doesn't seem to trigger the wrong line# report as often.
#15
11/22/2011 (6:49 pm)
@Mike, I sent the two lines by email, before and after #7, now technically the line after number 7 is number 10 because I indented twice
#16
11/22/2011 (7:15 pm)
Hmm. I haven't received anything yet. Btw, you can refer to me as Mich. That's what everyone else uses and it reduces confusion with the various other "Michael"s on the site. Though it is an awesome name.
#17
11/22/2011 (7:23 pm)
@Mich, okay I sent it again hopefully you'll recieve it...
#18
11/23/2011 (9:48 am)
Ok, spotted the errors and sent you a reply. Just in case others come across the thread, here are the major offenders.

1. Always make sure you have semi-colons. I found this code:

%template.BehaviorType = "Input"

It is missing a semi-colon.

2. Double check that you have the correct parenthesis. I found several of these

moveMap.unbindObject(getWord%this.upKey,0),getWord(%this.upKey,1),%this);

Which should be:

moveMap.unbindObject(getWord(%this.upKey,0),getWord(%this.upKey,1),%this);

Notice how I added a ( after the first getWord.