Gamestudio Links
Zorro Links
Newest Posts
Data from CSV not parsed correctly
by dr_panther. 05/06/24 18:50
Help with plotting multiple ZigZag
by degenerate_762. 04/30/24 23:23
M1 Oversampling
by 11honza11. 04/30/24 08:16
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
1 registered members (AndrewAMD), 1,135 guests, and 2 spiders.
Key: Admin, Global Mod, Mod
Newest Members
firatv, wandaluciaia, Mega_Rod, EternallyCurious, howardR
19050 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
problem with panels! #132454
05/28/07 09:11
05/28/07 09:11
Joined: Aug 2004
Posts: 1,305
New York
PrenceOfDarkness Offline OP
Serious User
PrenceOfDarkness  Offline OP
Serious User

Joined: Aug 2004
Posts: 1,305
New York
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]

Last edited by PrenceOfDarkness; 05/28/07 09:14.

"There is no problem that can't be solved with time and determination." -me
prenceofdarkness for instant messages on AIM.

Looking for a model designer
PLEASE, SEND ME A PRIVATE MESSAGE OR EMAIL IF YOU'RE INTERESTED.
Re: problem with panels! [Re: PrenceOfDarkness] #132455
05/28/07 10:15
05/28/07 10:15
Joined: Oct 2004
Posts: 1,655
T
testDummy Offline
Serious User
testDummy  Offline
Serious User
T

Joined: Oct 2004
Posts: 1,655
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.

Re: problem with panels! [Re: testDummy] #132456
05/28/07 15:38
05/28/07 15:38
Joined: Aug 2004
Posts: 1,305
New York
PrenceOfDarkness Offline OP
Serious User
PrenceOfDarkness  Offline OP
Serious User

Joined: Aug 2004
Posts: 1,305
New York
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..

Last edited by PrenceOfDarkness; 05/28/07 15:39.

"There is no problem that can't be solved with time and determination." -me
prenceofdarkness for instant messages on AIM.

Looking for a model designer
PLEASE, SEND ME A PRIVATE MESSAGE OR EMAIL IF YOU'RE INTERESTED.
Re: problem with panels! [Re: PrenceOfDarkness] #132457
05/29/07 18:19
05/29/07 18:19
Joined: Aug 2004
Posts: 1,305
New York
PrenceOfDarkness Offline OP
Serious User
PrenceOfDarkness  Offline OP
Serious User

Joined: Aug 2004
Posts: 1,305
New York
As it would turn out... window properties can't be local; must be global...


"There is no problem that can't be solved with time and determination." -me
prenceofdarkness for instant messages on AIM.

Looking for a model designer
PLEASE, SEND ME A PRIVATE MESSAGE OR EMAIL IF YOU'RE INTERESTED.
Re: problem with panels! [Re: PrenceOfDarkness] #132458
05/29/07 18:27
05/29/07 18:27
Joined: Aug 2005
Posts: 155
USA San Diego CA
Scramasax Offline
Member
Scramasax  Offline
Member

Joined: Aug 2005
Posts: 155
USA San Diego CA
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.


www.moxiefish.com George Lancaster
Re: problem with panels! [Re: Scramasax] #132459
05/30/07 04:31
05/30/07 04:31
Joined: Oct 2004
Posts: 1,655
T
testDummy Offline
Serious User
testDummy  Offline
Serious User
T

Joined: Oct 2004
Posts: 1,655
Some options:
1. hope that there is a fast enough bitmap bliting method available
2. str_cat chars with draw_text over entity

Re: problem with panels! [Re: testDummy] #132460
05/30/07 06:12
05/30/07 06:12
Joined: Aug 2004
Posts: 1,305
New York
PrenceOfDarkness Offline OP
Serious User
PrenceOfDarkness  Offline OP
Serious User

Joined: Aug 2004
Posts: 1,305
New York
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.


"There is no problem that can't be solved with time and determination." -me
prenceofdarkness for instant messages on AIM.

Looking for a model designer
PLEASE, SEND ME A PRIVATE MESSAGE OR EMAIL IF YOU'RE INTERESTED.
Re: problem with panels! [Re: PrenceOfDarkness] #132461
05/30/07 18:28
05/30/07 18:28
Joined: Oct 2004
Posts: 1,655
T
testDummy Offline
Serious User
testDummy  Offline
Serious User
T

Joined: Oct 2004
Posts: 1,655
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!?"


Moderated by  HeelX, Lukas, rayp, Rei_Ayanami, Superku, Tobias, TWO, VeT 

Gamestudio download | chip programmers | Zorro platform | shop | Data Protection Policy

oP group Germany GmbH | Birkenstr. 25-27 | 63549 Ronneburg / Germany | info (at) opgroup.de

Powered by UBB.threads™ PHP Forum Software 7.7.1