E1513 Crash maybe bug? verry curious

Posted By: uniquy

E1513 Crash maybe bug? verry curious - 10/15/09 05:06

Hi, sitting on this for 3 hours... and i realy think, that it only can be a BUG.

In this minimalistic code, you can see 2 "BAD" lines.
If one of it is removed, the code work.
Otherwise, together, i get:

Code:
E1513 Crash in ModelAdded



But whats realy crazy: If i set the ModelAdded function to just 1 parameter (ENTITY* ent_added), it works fine too.

Code:
#include <acknex.h>
#include <default.c>

ENTITY* ent;

void ModelAdded(ENTITY* ent_added, STRING* var_val){
	FONT* font1 = "Arial#18b";
	VECTOR* tmp;
	VECTOR* tmp2;
	
	vec_set(tmp.y, tmp2.y); // BAD LINE 1
	
	TEXT* txt = txt_create(1,1); // BAD LINE 2
}

void main()
{
	level_load("level.wmb");
	wait(3);
	
	ent = ent_create("cube.mdl",vector(0,0,0),NULL);
	ModelAdded(ent,"test");
}


Posted By: Quad

Re: E1513 Crash maybe bug? verry curious - 10/15/09 05:20


actual bad lines are this three;

FONT* font1 = "Arial#18b";
VECTOR* tmp;
VECTOR* tmp2;

on runtime you have to create fonts with font_create,
FONT* font1 = font_create("Arial#18b");

and then, tmp and tmp2 are just VECTOR pointers and not VECTORs and they are currently pointing to nothing, if you try to use them youll get a crash.
so change this lines:
VECTOR* tmp;
VECTOR* tmp2;
with:
VECTOR tmp;
VECTOR tmp2;

---

and before sitting in front of it 3 hours, and thinking it can only be a bug, check the manual.
Posted By: uniquy

Re: E1513 Crash maybe bug? verry curious - 10/15/09 05:34

oh sh.. im sorry! checked the manual many times, and searched here, but... ouph, could be eek im a noob o.O

But realy thanks!
Posted By: AloC83

Re: E1513 Crash maybe bug? verry curious - 01/29/10 12:50

here's another noob who spent 3 hours trying to solve this problem!

fellow noobs, beware of the difference between VECTOR and VECTOR* (between any pair of data type and pointers to that data type for that matter)
Posted By: archie

Re: E1513 Crash maybe bug? verry curious - 01/29/10 17:16

At the very least, there was a "hint" in the Gamestudio Wiki under Scripts\Basic Hints "VECTOR Declaration" but probably that alone is not enough to completely remove such "growing pains".
Posted By: Ottawa

Re: E1513 Crash maybe bug? verry curious - 01/29/10 19:33

Hi!

Also look for

Programming Trouble: FAQ

in manual wink
© 2023 lite-C Forums