• Hey Guest! Ever feel like entering a Game Jam, but the time limit is always too much pressure? We get it... You lead a hectic life and dedicating 3 whole days to make a game just doesn't work for you! So, why not enter the GMC SLOW JAM? Take your time! Kick back and make your game over 4 months! Interested? Then just click here!

What is the problem with my code

A

amp987

Guest
What is the problem in this error any help would be greatly appreciated ___________________________________________ ############################################################################################ FATAL ERROR in action number 1 of Draw Event for object obj_prop: Variable obj_prop.tex(100016, -2147483648) not set before reading it. at gml_Object_obj_prop_DrawEvent_1 (line 5) - d3d_model_draw(block,0,0,0,tex); ############################################################################################
 
T

TDSrock

Guest
Variable obj_prop.tex(100016, -2147483648) not set before reading it.
You might want to consider properly reading the error message. It is rather obvious what the problem is.
 
A

amp987

Guest
do you have a var named tex?
I dont think so this is my code for that section
///DRAW BLOCK
d3d_transform_set_identity();
d3d_transform_add_rotation_z( image_angle );
d3d_transform_add_translation(x1,y1,z);
d3d_model_draw(block,0,0,0,tex);
d3d_transform_set_identity();
 

rIKmAN

Member
do you have a var named tex?
No but I've got an Uncle...oh wait. :p
I dont think so this is my code for that section
///DRAW BLOCK
d3d_transform_set_identity();
d3d_transform_add_rotation_z( image_angle );
d3d_transform_add_translation(x1,y1,z);
d3d_model_draw(block,0,0,0,tex);
d3d_transform_set_identity();
Try looking again.
So do you have a variable name tex anywhere in your code?
 
S

SyntheticStorm9

Guest
d3d_model_draw(block,0,0,0,tex)

normally when you see a variable error you need to look for that variable,

you probably did the "tex" part of the code (above) wrong
 
S

SyntheticStorm9

Guest
I am not sure, I don't know what you added, and how to fix it, but in the error has the word tex in it, did you mean to spell it "text" instead of tex?
 
A

amp987

Guest
I am not sure, I don't know what you added, and how to fix it, but in the error has the word tex in it, did you mean to spell it "text" instead of tex?
Well do you know what you would need from me to fix my problem?
 
S

SyntheticStorm9

Guest
for you to check if you are using the word tex properly.
 

rIKmAN

Member
I am not sure, I don't know what you added, and how to fix it, but in the error has the word tex in it, did you mean to spell it "text" instead of tex?
No I doubt it, he's using 'd3d_model_draw' so it's a texture it's looking for.
Well how am I suspose to fix this problem
Well do you know what you would need from me to fix my problem?
Well considering you are looking for help, a little less attitude wouldn't go amiss.

Did you just copy and paste this code from somewhere, or did you write it yourself?
It's never a good idea to blindly copy/paste code without understanding what it's doing, you never learn anything.

The 'd3d_model_draw' function is looking for a texture for the model.
If you don't have one, use -1 instead of 'tex' in that bit of code (like it says in the docs I linked - you read the docs, right?...)

If you do have a texture for the model you need to load it and assign it to a variable called 'tex' before you call 'd3d_model_draw'.
 
S

Sam (Deleted User)

Guest
In the create event do this:

//Either
tex=background_get_texture(your_background)

//Or
tex=sprite_get_texture(your_sprite,0)

Or in the step event you can:
tex=sprite_get_texture(your_sprite,image_index)

...for animation.

change "your_background" or "your_sprite" to the sprite or background resource you would like to use as the texture of your block.
 
Top