problem with panels!

Posted By: PrenceOfDarkness

problem with panels! - 05/28/07 09:11

Okay.. I'm trying to create hp bars for everyone entity in the game... well not every entity.. but you know the typical stuff.. monsters..players..

The problem is the code only seems to work if I use a global variable... and I don't understand why... here is my code:

Code:

panel* hp_bar_panel_pointer;
define hp_bar_handle,skill45;

//the following is from inside my player script
var hp_bar_x = 0;
hp_bar_panel_pointer = pan_create("window(10, 10, 50, 5, hp_bar_bmp, hp_bar_x, 0);flags = visible; size_x = 100;size_y = 5;",1);
my.hp_bar_handle = handle(hp_bar_panel_pointer);
hp_bar_x=name_ent1(hp_bar_x);
//------------------------------------------------------------
function name_ent1(hp_bar_x_)
{
hp_bar_panel_pointer = ptr_for_handle(my.hp_bar_handle);

vec_set (temp, my.x);
temp.z += 40;
if(c_trace(my.x,camera.x,ignore_me|ignore_models|ignore_passents)==0&&my.health!= 0&&my.health_total!=0)
{
vec_to_screen (temp, camera);
name1_txt.pos_x = temp.x;
name1_txt.pos_y = temp.y;
hp_bar_panel_pointer.pos_x=name1_txt.pos_x;
hp_bar_panel_pointer.pos_y=name1_txt.pos_y+10;
name1_txt.visible = on;
hp_bar_panel_pointer.visible = on;
hp_bar_x_ = 50 - int(((my.health/my.health_total)/2)*100);
return(hp_bar_x_);
}
else
{
name1_txt.visible = off;
hp_bar_panel_pointer.visible = off;
}
}



if i make hp_bar_x a global variable and don't go bother with returning from name_ent1 everything seems to work fine... but I ABSOLUTELY NEED this to work with hp_bar_x being a local variable. I even tried doing this as hp_bar_x being a skill and I still couldn't get it to work... maybe someone can see something i can't. I'm starting to think of this as a bug.

[edit]
btw this is a logic error not syntex incase i wasn't clear on that...
[/edit]
Posted By: testDummy

Re: problem with panels! - 05/28/07 10:15

Maybe it's a clear indication that real compiler updates have been missing for quite some time. No, definitely it is not THAT. You might attempt to promptly purchase Lite-C, or you could try praying that the bmap blitting functions are quick enough to emulate hbars...er windows?

Choose one of the following:
*It's a bug. (not likely; go on, try to get it fixed now)
*It's a 'slack' feature omission. (possible)
*It's a calculated 'marketable' feature omission. (possible)
*None of the following.

To be clear, I'm not absolutely certain that 'global vars' are required for hbars or windows, but based on comparisons elsewhere, I would have expected such requirements.
Posted By: PrenceOfDarkness

Re: problem with panels! - 05/28/07 15:38

There have been other stupid glitches but I've found stupid ways to get around them... AND MAN... DO I MEAN STUPID GLITCHES!

Regardless... i'm kind of tired of wasting my time argueing with conitec... after buying pro and getting my so hard earn tech support... they gave me the run around for three weeks.. ("may take upto two days for you two get an answer"..."Oops... the tech 'guy' is on vacation.. he wont be back until next week")

so help from conitec is out of the answer... i get the feeling sometimes ppl on the forum know more about the engine then conitec -_-'

edit: besides... I have nothing left to play with... they already got me to buy pro..
Posted By: PrenceOfDarkness

Re: problem with panels! - 05/29/07 18:19

As it would turn out... window properties can't be local; must be global...
Posted By: Scramasax

Re: problem with panels! - 05/29/07 18:27

I've done this in the past, but through a .dll, using c++ and it wasn't to hard to do. Not that this helps if you don't program.
Posted By: testDummy

Re: problem with panels! - 05/30/07 04:31

Some options:
1. hope that there is a fast enough bitmap bliting method available
2. str_cat chars with draw_text over entity
Posted By: PrenceOfDarkness

Re: problem with panels! - 05/30/07 06:12

I found a work around that seems to work... More or less... i have a set number of panels hopefully a bit more then will ever be present at the same time on the screen, and I just set them to a character in the game... This seems to work for now. I guess as long as it looks right it doesn't matter how you do it.
Posted By: testDummy

Re: problem with panels! - 05/30/07 18:28

Quoting PrenceOfDarkness.
Quote:

I guess as long as it looks right it doesn't matter how you do it.



"Behold, Conitec has poisoned the mind of a budding computer scientist!?"
© 2024 lite-C Forums