Gamestudio Links
Zorro Links
Newest Posts
Newbie Questions
by fairtrader. 12/05/23 14:22
Zorro Trader GPT
by TipmyPip. 12/04/23 11:34
Square root rule
by Smallz. 12/02/23 09:15
RTest not found error
by TipmyPip. 12/01/23 21:43
neural function for Python to [Train]
by TipmyPip. 12/01/23 14:47
Xor Memory Problem.
by TipmyPip. 11/28/23 14:23
Training with command line parameters
by TipmyPip. 11/26/23 08:42
Combine USD & BTC Pairs In Asset Loop
by TipmyPip. 11/26/23 08:30
AUM Magazine
Latest Screens
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Tactics of World War I
Who's Online Now
0 registered members (), 631 guests, and 2 spiders.
Key: Admin, Global Mod, Mod
Newest Members
fairtrader, hus, Vurtis, Harry5, KelvinC
19019 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
A problem with ptr_for_handle #155817
09/20/07 23:23
09/20/07 23:23
Joined: Aug 2005
Posts: 390
Florida
O
oldschoolj Offline OP
Senior Member
oldschoolj  Offline OP
Senior Member
O

Joined: Aug 2005
Posts: 390
Florida
Hi folks,

I'm wondering why this doesnt work, any help would be much appreciated.

First, I've made a panel entity, and created where I need it:

Code:
PANEL* item_icon_0000;
item_icon_0000 = pan_create ("bmap = ui_itembmap_0000; flags = VISIBLE;", 2);
item_icon_0000.pos_x = ui_inv_panel.pos_x + ui_inv_posx_array[0];
item_icon_0000.pos_y = ui_inv_panel.pos_y + ui_inv_posy_array[0];



Next, I've defined a handle for the panel, and store it in an array:

Code:
ui_inv_slot_array[0] = handle(item_icon_0000);



Now I make a pointer to call it up like this:
Code:
if (mouse_item_location == 0) 
{
you = ptr_for_handle (ui_inv_slot_array[0]);
while (mouse_left == 1)
{
you.pos_x = mouse_pos.x;
you.pos_y = mouse_pos.y;
wait (1);
}
you.pos_x = ui_inv_panel.pos_x + ui_inv_posx_array[0];
you.pos_y = ui_inv_panel.pos_y + ui_inv_posy_array[0];
ui_inv_slot_array[0] = handle (you);
mouse_item=0;
}



Now, I get an error "pos_x is not a member of entity".
This is what I have noticed, the code is almost right, because If I remove pos_x, and pos_y, and replace it with just x, and y, the panel moves around fine, and is stored fine afterwards, because I can do as much moving around as I need.

But the problem is, that with just x, and y (instead of pos_x, and pos_y) it doesnt move properly, things are all out of order...

Why does it work with .x, and .y, and not work with pos_x and pos_y?
Does anyone know what I am doing wrong?

Thanks for the help,




you can find me with my face in the keyboard, unshaven, listening to some nameless techno tragedy, and hashing through code over a cold cup a stale joe. __________________________________ yours truly
Re: A problem with ptr_for_handle [Re: oldschoolj] #155818
09/21/07 02:17
09/21/07 02:17
Joined: Aug 2005
Posts: 390
Florida
O
oldschoolj Offline OP
Senior Member
oldschoolj  Offline OP
Senior Member
O

Joined: Aug 2005
Posts: 390
Florida
I actually solved the problem, heh. Apparently I needed to make a PANEL* entity, like PANEL* temp_panel, and assign that instead of you. So if there is anyone else who has had this problem, I guess the reason why I was getting the "not a member of entity" is because pos_x, or pos_y had to be a member of a panel entity. cool


you can find me with my face in the keyboard, unshaven, listening to some nameless techno tragedy, and hashing through code over a cold cup a stale joe. __________________________________ yours truly

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