Game Development Community

An issue with "predefined" functions.

by Aaron Soules · in Torque Game Builder · 01/27/2006 (7:16 pm) · 15 replies

Hey all,

I'm having a couple issues, be it good or bad, they are quite similar.
At first I thought it was just my understanding of the torque script, but after running a few things through the console, I realize the problem is not as much my fault as I thought.

First issue:
One of the functions in my script is t2dAngleBetween() which was cut and paste strait out of the reference guide (http://tdn.garagegames.com/wiki/Torque_2D/Reference_Guide)

When I run "echo(t2dAngleBetween());" in the console I get the message, " (0): Unable to find function t2dAngleBetween"

Second issue:
Another one of the functions in the script is "getMousePosition()" pretty much the same story as above, I cut and pasted it into the script, and I get a similar echo when I tried "echo(getMousePosition());"

So, is my copy of T2D screwed up, or do I need to define those functions? If so, is there some resource that I can just acquire them from? They seem like they would be very common.

(I'm using the code in a "space invaders" type setting, just trying to make the player fire in the direction of the mouse, a very basic game for a first attempt at T2D)

#1
01/27/2006 (7:55 pm)
What version of Torque 2D are you using ?
#2
01/27/2006 (8:51 pm)
Short answer: I'm not sure Exactly

Long answer: I downloaded it 2-3 days ago, and the setup file was titled "Torque2DSDK_1_0_2.exe" so I assume 1.0.2

is there a better version for me to be using?
#3
01/28/2006 (12:43 am)
There is an alpha version (1.1 alpha 3 as i type this post) on the download page as well.. That documentation you linked is written for that version.
#4
01/28/2006 (12:51 am)
On the download page where you got 1.0.2 (Torque 2D indie license - source) you should see 2 other links right below it for the 1.1 version Alpha3a and Alpha3b. For a new user, I personally would recommend Alpha3b because it has the new directory structure included. Ignore what those links says about how the alpha is for advanced developers, etc. I've found all versions of the alpha to be quite stable and I think most everything in TDN is already written for 1.1 users.

For GG people: do you think the link for 1.0.2 could be moved to the bottom of the download list along with a comment mentioning that most references and resources have moved on to the 1.1 codebase? I know why you put the warning for the Alpha releases there, but so far everything has been just as stable as 1.0.2 ever was and not just advanced developers benifit from the switch. Plus most forum posts deal with code/issues from 1.1 and as mentioned above almost all TDN articles have moved to 1.1 too. I think it would spare newcomers to T2D a bit of confusion.
#5
01/28/2006 (10:10 am)
Thanks!

I'll get on that immediately.
Should that fix the problem i was having?
#6
01/28/2006 (4:48 pm)
A last question (maybe)
www.hybridfire.com/problem.jpgI've checked my code over for about the tenth time, and found maybe three things that I could fix, and according to the console, it seems that my images just won't load.

Seeing as there are many changes between 1.0.2 and 1.1 Alpha3b I was wondering if there is some change I havn't found yet that would stop these images from working

I suspect that maybe t2dImageMapdatablock changed its name, but I cut and paste my datablocks from sampleDatablocks.cs and just changed the filenames.

Do I need to define "standardMaterial"?
Since I cut and pasted it from the tutorial-
%enemy.setCollisionMaterial( standardMaterial );
I would think that it's clean
#7
01/29/2006 (11:18 am)
I think the main issue is the errors that datablocks.cs generate. Check where your images are and make sure the path to them is correct. Register object failed messages mean T2D cant find your images.
#8
01/29/2006 (11:53 am)
Something's going very wrong in the first set of failures. The T2D alpha now reports much more comprehensive errors as discussed in the image-map doco. These will be immediately before the final "Register object failed" error that the engine core dishes out.

For instance, changing the image to an invalid one gives me...
ImageMap(ggLogoImageMap) Error: 'Invalid Bitmap File!' (2)
T2D/data/content/sampleDatablocks.cs (0): Register object failed for object ggLogoImageMap of class t2dImageMapDatablock.
... something more fundamental is going on here. Either that or error-echo has been turned off using "$pref::T2D::imageMapEchoErrors = false".

It would be worth while seeing just one of those image-maps above; "characterImageMap", "zImageMap" etc.

- Melv.
#9
01/29/2006 (2:28 pm)
Changing to an invalid image only gave me the Register object failed message, I had to type the $pref::T2D line into the console and restart to get a complete error message like you did above Melv. Might it be default off in stock Alpha3b? I dont see it anywhere in a fresh install of prefs.cs until I type it in myself.
#10
01/29/2006 (4:03 pm)
Well, I just copied those images over from my 1.0.2 folder where I had them working.
and I definately checked the filepaths at least three times...

Is there some new image requirement? or one that 1.0.2 would have let slide?
#11
01/29/2006 (9:31 pm)
Did you chnage every instance of fx to t2d?
#12
01/30/2006 (1:08 am)
I do believe that they were omitted from the 3b alpha so that could be why you're not getting them. Also, in-engine, the "getBoolVariable()" didn't specify the default so it probably defaulted to false if not specified.

That's been changed for the next release.

@Aaron: As I've said, it would be much easier if you just post one your image-maps here. The image-data hasn't changed, that is part of the core. Have you read about the new image-maps in the doco? They explain everything.

- Melv.
#13
01/31/2006 (6:07 pm)
I don't think that it could simply be my images, as when I change the datablocks to point to images that came with the program they still don't load...
#14
02/01/2006 (12:52 am)
@Aaron: I'm afraid I just can't help you if you just simple post messages like that and ignore my requests for further information. Sorry to sound an ass but I've asked a couple of times for your image-maps.

Unfortunately, without further info, I'm just unable to help you, something which I'd like to do.

Please, please, please post your image-map(s) script so I can look for any obvious errors.

- Melv.
#15
03/15/2006 (3:58 pm)
I had a similar problem when upgrading... make sure your datablock.cs file uses the correct variable names.

For example:
(CODE BLOCK is from T2D Beta 1.1)
datablock t2dImageMapdatablock(CheckersBoardImageMap)
{
	imageName = "~/data/Images/Checkers_board";
	imageMode = full;
	filterPad = false;
};

In an older release instead of imageName it was textureName, and instead of imageMode it was just mode.

I hope this helps anybody who might also have had this problem.