mouse_ent A8

Posted By: Germanunkol

mouse_ent A8 - 06/16/12 19:20

Hi,

Again, a problem when upgrading to A8: "mouse_ent" is always NULL, no matter where I move the mouse.

Code:
while(1)
	{
		draw_text(str_for_num(NULL, mouse_range), 200,150, vector(200, 250,250));
		if(mouse_ent)
		draw_text(str_for_entfile(NULL, mouse_ent), 200,100, vector(200, 250,250));
		else
		draw_text("nil", 200,100, vector(200, 250,250));
		wait(1);
	}


I wrote this code to help me debug: it always prints nil.
Mouse_range is 99999.
Tried with mouse_mode 4 and 0.
Posted By: PadMalcom

Re: mouse_ent A8 - 06/16/12 20:35

Your mouse_range might be too low.
Posted By: FoxHound

Re: mouse_ent A8 - 06/16/12 22:50

How wide is the model? Make a square that is just plain silly huge in it's width. If it is still null then assign that square the handle "player" and check to see if mouse_ent is player. I don't always trust "if(mouse_ent)" type equations when it comes to pointers.
Posted By: Germanunkol

Re: mouse_ent A8 - 06/17/12 07:35

Thanks for your replies!

My level IS way too large (back when we started, I made everything to fit the player model) but 99999 should be enough to touch something when I fly close to it. I even tried the highest number the integer can hold. It can't be too low (it always worked in A7 and with the older shadeC - it might also be shadeC).

The code above was only for testing purposes, that's not the real code that tries to work with mouse_ent. The actual code checks mouse_ent == NULL as far as I remember (I'm not at home right now). Still, if(mouse_ent) is the correct syntax, I believe the only time these don't work is when there's multiple terms, like this:
if(a==b && mouse_ent) //this fails sometimes
but
if(mouse_ent) should work.

Funny thing is: even IF shadeC had an entity that blocked it all, then it should either print the name of that entity, or - if the entity is UNTOUCHABLE then it should print the name of the entities behind it, meaning the level entities that I want to get -.-
But it just sticks to "nil".
Posted By: EvilSOB

Re: mouse_ent A8 - 06/17/12 07:50

Ive used mouse_ent a few times in A8, and had no problems.

So if it really is the "if(a==b && mouse_ent)" that is failing,
have you tried it as "if((a==b) && (mouse_ent))" instead?
Posted By: Germanunkol

Re: mouse_ent A8 - 06/17/12 07:52

No, sorry, I wasn't clear on that:
I'm not using "if(a==b && mouse_ent", I'm just saying that this could fail, but if(mouse_ent) - which I AM using - should not.
Posted By: Superku

Re: mouse_ent A8 - 06/17/12 13:35

Hm you can easily write the mouse_ent feature yourself (using mouse_dir3d and c_trace), I suggest you give that one a try and compare the results.
Posted By: FoxHound

Re: mouse_ent A8 - 06/17/12 16:05

start a new project and try this code. If it works then, then there is something else in your code that could be affecting it.
Posted By: Germanunkol

Re: mouse_ent A8 - 06/19/12 10:48

I did. Thanks, it worked.

mouse_ent behaves the same, it's some other code (messing around with camera views) which made it fail.
I'll have to find the problem there...

Thanks for all the replies!
Posted By: Superku

Re: mouse_ent A8 - 06/19/12 13:52

Did you try to set all non-camera and non-pp views to UNTOUCHABLE?
© 2024 lite-C Forums