Gamestudio Links
Zorro Links
Newest Posts
Change chart colours
by 7th_zorro. 05/11/24 09:25
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
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
3 registered members (AndrewAMD, dr_panther, henrybane), 1,101 guests, and 4 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
Page 1 of 3 1 2 3
Is it possible to change panel BMAP? #366515
04/04/11 18:41
04/04/11 18:41
Joined: Aug 2007
Posts: 74
Mahdi Offline OP
Junior Member
Mahdi  Offline OP
Junior Member

Joined: Aug 2007
Posts: 74
hi there,

I want to create a inventory. a simple one.

I have a panel and I want to change it's BMAP from a function.

Code:
inventory_panel.bmap="an_image.tga";



but I don't know why the game crashes when It want to run this line.

instead if I use something like this:

Code:
bmap inventory_image = "an_image.tga";
...
inventory_panel.bmap="inventory_image";



The game runs normally without any problem.

But I in a situation that I should use the first method. is there anyway?


I don't care!
Re: Is it possible to change panel BMAP? [Re: Mahdi] #366516
04/04/11 18:46
04/04/11 18:46
Joined: Jul 2004
Posts: 785
Serbia
Iglarion Offline
User
Iglarion  Offline
User

Joined: Jul 2004
Posts: 785
Serbia
First define your first panel:

Code:
PANEL inventory_panel{
	bmap img_inventory_panel;
	layer = 41;
	pos_x = 315;
	pos_y = 202;
	flags = refresh, transparent, overlay;	
}



then second bmap:
bmap Img_inventory_panel2 = "panel2.tga";

then
Code:
if(something){
     inventory_panel.bmap = Img_inventory_panel2;
}





Re: Is it possible to change panel BMAP? [Re: Iglarion] #366517
04/04/11 18:57
04/04/11 18:57
Joined: Aug 2007
Posts: 74
Mahdi Offline OP
Junior Member
Mahdi  Offline OP
Junior Member

Joined: Aug 2007
Posts: 74
yeah, I know that, but I can't define a bmap via a function, can I?

Is there anyway to define the second bitmap in runtime?


I don't care!
Re: Is it possible to change panel BMAP? [Re: Mahdi] #366518
04/04/11 19:02
04/04/11 19:02
Joined: Jul 2004
Posts: 785
Serbia
Iglarion Offline
User
Iglarion  Offline
User

Joined: Jul 2004
Posts: 785
Serbia
Ohh sorry i now understand what you need...
I think no on this way... only if you define first panel like entity.

For entity you can try make sth like this:
Code:
ENTITY Inv_panel {
	type = <inventory_panel.tga>;
	layer = 10;
	flags = visible;
	view = camera;
	x = 100;
	y = 100;
}



then you can use ent_morph

Last edited by Iglarion; 04/04/11 19:31.
Re: Is it possible to change panel BMAP? [Re: Iglarion] #366556
04/05/11 00:19
04/05/11 00:19
Joined: Jan 2002
Posts: 4,225
Germany / Essen
Uhrwerk Offline
Expert
Uhrwerk  Offline
Expert

Joined: Jan 2002
Posts: 4,225
Germany / Essen
Code:
void change_bitmap()
{
	ptr_remove(inventory_panel->bmap);
	inventory_panel->bmap = bmap_create("newfile.bmp");
}


That should do the trick. Your first version crashes because you assign a char array to a bitmap pointer. This can't work...


Always learn from history, to be sure you make the same mistakes again...
Re: Is it possible to change panel BMAP? [Re: Uhrwerk] #366574
04/05/11 12:10
04/05/11 12:10
Joined: Aug 2007
Posts: 74
Mahdi Offline OP
Junior Member
Mahdi  Offline OP
Junior Member

Joined: Aug 2007
Posts: 74
Originally Posted By: Uhrwerk
Code:
void change_bitmap()
{
	ptr_remove(inventory_panel->bmap);
	inventory_panel->bmap = bmap_create("newfile.bmp");
}


That should do the trick. Your first version crashes because you assign a char array to a bitmap pointer. This can't work...


Your code is in Lite-c, but Thanks that is what I need. I found my answer partially.

Is it possible to use such a code:

Code:
inventory_item1.bmap = bmap_create(player.string1);



It should work, but I don't know why engine says, empty porinter!But I already filled the player's string1 with "an_image.bmp" and built the level.

All I want to do is: every entity in my game that can be picked by the player, should have a 2d image. This 2d image is used in inventory.

so I want to use something like:

Code:
inventory_item1.bmap = bmap_create(player.string1);



to achieve what I want.

Is it possible?


I don't care!
Re: Is it possible to change panel BMAP? [Re: Mahdi] #366575
04/05/11 12:27
04/05/11 12:27
Joined: Feb 2010
Posts: 320
TANA/Madagascar
3dgs_snake Offline
Senior Member
3dgs_snake  Offline
Senior Member

Joined: Feb 2010
Posts: 320
TANA/Madagascar
I think that the string must be set in wed only, and must not be changed at runtime. Also its max length is 32 characters and it is A CHAR pointer not a STRING, so perhaps you could use _str() function to create a temporary string fom it.

Hope that helps.

Best regards.

Re: Is it possible to change panel BMAP? [Re: Mahdi] #366577
04/05/11 12:36
04/05/11 12:36
Joined: Aug 2007
Posts: 74
Mahdi Offline OP
Junior Member
Mahdi  Offline OP
Junior Member

Joined: Aug 2007
Posts: 74
I solved the problem.

The problem was caused because there is a bug with WED (a7).

I entered "an_image.bmp" into the player's string1 and built the level, but WED didn't save the string1.

So i tried to write the line below in the player's action:

my.string1="an_image.bmp";

and now everything is ok!

Thank you guys.


I don't care!
Re: Is it possible to change panel BMAP? [Re: Mahdi] #366580
04/05/11 12:49
04/05/11 12:49
Joined: Feb 2010
Posts: 320
TANA/Madagascar
3dgs_snake Offline
Senior Member
3dgs_snake  Offline
Senior Member

Joined: Feb 2010
Posts: 320
TANA/Madagascar
Hi,

Glad to know you solved your problem. I think that I discovered somethink like this yesterday, but didn't know the cause. To solve mine, I put something in string2.

Best regards.

Re: Is it possible to change panel BMAP? [Re: 3dgs_snake] #441957
06/07/14 13:15
06/07/14 13:15
Joined: Jun 2014
Posts: 97
Lagos, Nigeria
T
tolu619 Offline
Junior Member
tolu619  Offline
Junior Member
T

Joined: Jun 2014
Posts: 97
Lagos, Nigeria
I'm still struggling with this. I defined a bmap earlier now it says "script crash in *insert function name here*" whenever I try to assign the bmap to a panel.

Code:
BMAP* GoshawkChosen = "GoshawkCharacterChosen.bmp";

PANEL* PlayerOnePan =
{
	pos_x = 20;
	pos_y = 100;
	layer = 8;
	flags |= OVERLAY;
}

function ChooseGoshawk()
{
...some code here...
	PlayerOnePan.bmap = GoshawkChosen;
....more code...
}


Page 1 of 3 1 2 3

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