All I need is the real examples to cross reference!
by Fernando Hurtado Jr · in Torque Game Builder · 07/16/2009 (3:15 pm) · 20 replies
IS THAT SO HARD NOT ONE PERSON HAS POINTED ME IN THAT DIRECTION!!!
"Shooter Tutorial"
function PlayerShip::fireMissile(%this)
##{##
// If the player is dead, don't fire a missile
if (%this.isDead) {
return;
}
// Create a missile
%this.playerMissile = new t2dStaticSprite();
{
scenegraph = %this.scenegraph;
class = PlayerMissile;
missileSpeed = %this.missileSpeed;
player = %this;
};
// Fire the missile
%this.playerMissile.fire();
}
I've cut and pasted this thing after typing it in and still RED##{##
"Shooter Tutorial"
function PlayerShip::fireMissile(%this)
##{##
// If the player is dead, don't fire a missile
if (%this.isDead) {
return;
}
// Create a missile
%this.playerMissile = new t2dStaticSprite();
{
scenegraph = %this.scenegraph;
class = PlayerMissile;
missileSpeed = %this.missileSpeed;
player = %this;
};
// Fire the missile
%this.playerMissile.fire();
}
I've cut and pasted this thing after typing it in and still RED##{##
About the author
Recent Threads
#2
Now, calmly, please explain what kind of errors you are getting?
Have you checked your console log for warnings or errors?
What tutorial are you using?
Have you gone through the standard documentation?
Please try and stick to just 1 thread. There's no reason to spam the forums about the same issue.
07/16/2009 (3:30 pm)
@Fernando - Slow down. Calm down. Be considerate.Now, calmly, please explain what kind of errors you are getting?
Have you checked your console log for warnings or errors?
What tutorial are you using?
Have you gone through the standard documentation?
Please try and stick to just 1 thread. There's no reason to spam the forums about the same issue.
#3
Michael Perry,(the guy in the hat)Thanks for the Hand.
function PlayerShip::fireMissile(%this)
##{##
// If the player is dead, don't fire a missile
if (%this.isDead) {
return;
}
// Create a missile
%this.playerMissile = new t2dStaticSprite();
{
scenegraph = %this.scenegraph;
class = PlayerMissile;
missileSpeed = %this.missileSpeed;
player = %this;
};
// Fire the missile
%this.playerMissile.fire();
}
The Game Works the Missles Fire but this function is always red in console and it always ##{## the same spot.
07/16/2009 (3:34 pm)
the ; was actually the last thing I threw in there to stop the bleeding, it has been deleted.Michael Perry,(the guy in the hat)Thanks for the Hand.
function PlayerShip::fireMissile(%this)
##{##
// If the player is dead, don't fire a missile
if (%this.isDead) {
return;
}
// Create a missile
%this.playerMissile = new t2dStaticSprite();
{
scenegraph = %this.scenegraph;
class = PlayerMissile;
missileSpeed = %this.missileSpeed;
player = %this;
};
// Fire the missile
%this.playerMissile.fire();
}
The Game Works the Missles Fire but this function is always red in console and it always ##{## the same spot.
#4
Looks like Fernando is fighting with Torque's error reporting for parsing errors. Torque marks them with the hash signs that supposedly should be around the location where the error occurred, but they're almost always someplace else altogether. So, you need to scan the code and check your syntax.
In the snippet above, the object declaration is wrong.
BTW, Fernando, there's scripting language documentation on TDN that explains this in detail.
07/16/2009 (3:37 pm)
Looks like Fernando is fighting with Torque's error reporting for parsing errors. Torque marks them with the hash signs that supposedly should be around the location where the error occurred, but they're almost always someplace else altogether. So, you need to scan the code and check your syntax.
In the snippet above, the object declaration is wrong.
BTW, Fernando, there's scripting language documentation on TDN that explains this in detail.
#5
What your seeing in the console is the parsing errors reported by Torque. Again, in your snippet above, same problem. It must be:
07/16/2009 (3:39 pm)
What your seeing in the console is the parsing errors reported by Torque. Again, in your snippet above, same problem. It must be:
%this.playerMissile = new t2dStaticSprite() // no semicolon here!!!
{
scenegraph = %this.scenegraph;
class = PlayerMissile;
missileSpeed = %this.missileSpeed;
player = %this;
};
#6
07/16/2009 (3:49 pm)
When the script compiler highlights a line in the console like that it typically means the problem occurs shortly before that point.
#7
Does anyone have the right code besides the ";"
it's still #### me. I'll get back to You.
07/16/2009 (6:03 pm)
I deleted said ";" I'm still getting it.Does anyone have the right code besides the ";"
it's still #### me. I'll get back to You.
#8
Chances are you missed a closing brace, or even a terminating semi-colon for the previous line, and now the script is buggin out trying to figure what that bracket ##{## is for and thinks something else should go there.
But hey, if it's working....
Just a note, but if you don't want people to point out the obvious errors in the code you've pasted above (that you may have already fixed) you should paste the "fixed" code when you repost instead of repasting the same error.
07/16/2009 (9:31 pm)
Count your brackets {} before function PlayerShip::fireMissile(%this) and make sure they "pair up" before entering that function. Chances are you missed a closing brace, or even a terminating semi-colon for the previous line, and now the script is buggin out trying to figure what that bracket ##{## is for and thinks something else should go there.
But hey, if it's working....
Just a note, but if you don't want people to point out the obvious errors in the code you've pasted above (that you may have already fixed) you should paste the "fixed" code when you repost instead of repasting the same error.
#9
now, you need to calm the phuck down, and present your problems nicely... the way you're doing it, is just NOT right... adn to top it off, you dont give us enough meat to help you out (instead, you just discourage us to do so).
07/17/2009 (1:22 am)
it would be a good idea for you to use Torsion as your scripting IDE, that way, you know at runtime where the errors are, and can check them, and maybe spot them on the fly...now, you need to calm the phuck down, and present your problems nicely... the way you're doing it, is just NOT right... adn to top it off, you dont give us enough meat to help you out (instead, you just discourage us to do so).
#10
function PlayerShip::fireMissile(%this)
##{##
// If the player is dead, don't fire a missile
if (%this.isDead) {
return;
}
you see the ##{## right under the function, take out the # signs.
function PlayerShip::fireMissile(%this)
{
// If the player is dead, don't fire a missile
if (%this.isDead)
return;
}
07/17/2009 (6:06 am)
what i see is..function PlayerShip::fireMissile(%this)
##{##
// If the player is dead, don't fire a missile
if (%this.isDead) {
return;
}
you see the ##{## right under the function, take out the # signs.
function PlayerShip::fireMissile(%this)
{
// If the player is dead, don't fire a missile
if (%this.isDead)
return;
}
#11
You deleted the { between (%this.isDead) { return;.
07/17/2009 (11:39 am)
I'm showing You what comes back not what I put in, I put it in without the ####.You deleted the { between (%this.isDead) { return;.
#12
if(%this.isDead)
return
or
if(%this.isDead)
{
return
}
07/17/2009 (11:46 am)
right. you cant have an open { with no closing one. you can use it like thisif(%this.isDead)
return
or
if(%this.isDead)
{
return
}
#13
ClickTeam is doing some awesome work here with its Multimedia Fusion that requires no (textual) programming whatsoever and has proven itself in some pretty awesome indie games. The Spirit Engine 2 immediately springs to my mind which IMO is just about one of the most incredible indie games ever created.
If you want something to create 2D games without writing a single line of code, this is really something worth looking at.
07/17/2009 (11:48 am)
Not to be rude, but honestly, Fernando, if you can't get past even the compilation step without shelling out some pretty rough stuff on the forum, then you either need to sit down and really learn some basics or you may be indeed better off with a different kind of game making tool altogether.ClickTeam is doing some awesome work here with its Multimedia Fusion that requires no (textual) programming whatsoever and has proven itself in some pretty awesome indie games. The Spirit Engine 2 immediately springs to my mind which IMO is just about one of the most incredible indie games ever created.
If you want something to create 2D games without writing a single line of code, this is really something worth looking at.
#14
07/17/2009 (11:48 am)
ah nevermind, scratch what i said, i see it now...
#15
Why don't you show the whole script file, or at least the contents before that location.. To me the actual "real" error is occurring before that function which is why you're getting the parse error there.
07/17/2009 (11:49 am)
I think Timothy got confused... using the [ code ] [ /code ] tags will make it easier on anyone trying to help you. Why don't you show the whole script file, or at least the contents before that location.. To me the actual "real" error is occurring before that function which is why you're getting the parse error there.
#16
07/17/2009 (11:51 am)
right...its so much easier to read with code tags
#17
07/17/2009 (11:54 am)
post a link to your source files so i can plug them into torsion and see what it spits out...
#18
07/17/2009 (2:37 pm)
... i really wouldnt bother helping this guy... not this way.
#19
I've gone so far as to delete the
if(%this.isDead)
{
return
}
and START YET ANOTHER PROJECT FROM SCRATCH.
07/18/2009 (7:42 am)
TKI've gone so far as to delete the
if(%this.isDead)
{
return
}
and START YET ANOTHER PROJECT FROM SCRATCH.
#20
It looks like Scott Burns gave you the answer way the way up there.
07/18/2009 (7:27 pm)
Hehe... this stuff is fun to read.It looks like Scott Burns gave you the answer way the way up there.
Associate Rene Damm
BTW, you caps lock key seems defunct. And your tone is off the mark.