Gamestudio Links
Zorro Links
Newest Posts
AlpacaZorroPlugin v1.3.0 Released
by kzhao. 05/20/24 01:28
Free Live Data for Zorro with Paper Trading?
by AbrahamR. 05/18/24 13:28
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
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
1 registered members (AndrewAMD), 629 guests, and 2 spiders.
Key: Admin, Global Mod, Mod
Newest Members
Hanky27, firatv, wandaluciaia, Mega_Rod, EternallyCurious
19051 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Page 2 of 3 1 2 3
Re: Creating row of panels in runtime [Re: Gordon] #273827
06/24/09 16:14
06/24/09 16:14
Joined: Jul 2004
Posts: 1,710
MMike Offline
Serious User
MMike  Offline
Serious User

Joined: Jul 2004
Posts: 1,710
Originally Posted By: Gordon
PNG files are note supported. Well at least not in this area based on the manual (unless it is wrong here)

"The image must be in PCX, BMP, or TGA format."

PGN is supported for sprites and textures but it is not recommended as it is loaded by direct X and can be lost during run-time.

again from the manual

"PNG images behave like TGA images, but are not recommended because they are loaded not by the engine, but by the DirectX library, and are not guaranteed to be automatically restored when the video device gets lost. This means that they can lose their content f.i. when a fullscreen application is minimized."

hope this helps


It has nothing to do with PNG, i alway use PNG format for panels., they are smaller, and better quality.

Re: Creating row of panels in runtime [Re: MMike] #273851
06/24/09 17:47
06/24/09 17:47
Joined: Oct 2008
Posts: 67
C
Crypton Offline OP
Junior Member
Crypton  Offline OP
Junior Member
C

Joined: Oct 2008
Posts: 67
mm yes I see... smile. I thought that "wait" allows to "go out of the loop" and execute other functions for one step and then in the next step the loop repeats. But main() is being executed once and when "while" is met, it's stays there...

Another quick question. I'd like to create multidimensional array and access it's value.

var arr[2][2]; //Define multidimesnional array, with 2 columns and 2 row..
//Giving values to aadresses
arr[0][0] = 5;
arr[0][1] = 30;
arr[1][0] = 10;
arr[1][1] = 50;

and accessing certain value ?:
add_on = (arr[g_type][0] - bullets); //g_type is whether 0 or 1.

Last edited by Crypton; 06/24/09 19:26.

New into Gamestudio and eager to learn it..
Stuff and games done in 2D: LINK
Re: Creating row of panels in runtime [Re: Crypton] #274007
06/25/09 10:40
06/25/09 10:40
Joined: Oct 2008
Posts: 67
C
Crypton Offline OP
Junior Member
Crypton  Offline OP
Junior Member
C

Joined: Oct 2008
Posts: 67
any clue ?
sry for urgent bump, but I'm getting desperate :P


New into Gamestudio and eager to learn it..
Stuff and games done in 2D: LINK
Re: Creating row of panels in runtime [Re: Crypton] #274042
06/25/09 13:09
06/25/09 13:09
Joined: Aug 2003
Posts: 902
Van Buren, Ar
Gordon Offline
User
Gordon  Offline
User

Joined: Aug 2003
Posts: 902
Van Buren, Ar
the code you posted "looks" right. What is the problem you are having.


Our new web site:Westmarch Studios
Re: Creating row of panels in runtime [Re: Gordon] #274095
06/25/09 17:07
06/25/09 17:07
Joined: Oct 2008
Posts: 67
C
Crypton Offline OP
Junior Member
Crypton  Offline OP
Junior Member
C

Joined: Oct 2008
Posts: 67
My problem is I don't get that value I try to access.
f.i. I have defined:

var arr[2][2];
//set values:
arr[0][0] = 5;
arr[0][1] =10;

and I want to get certain array value:

add_on = arr[0][g_type]; //g_type is whether 0 or 1.

I don't get the value... add_on is 0 when it should be 10 when g_type is f.i 1.

Last edited by Crypton; 06/25/09 17:07.

New into Gamestudio and eager to learn it..
Stuff and games done in 2D: LINK
Re: Creating row of panels in runtime [Re: Crypton] #274164
06/25/09 22:30
06/25/09 22:30
Joined: Aug 2003
Posts: 902
Van Buren, Ar
Gordon Offline
User
Gordon  Offline
User

Joined: Aug 2003
Posts: 902
Van Buren, Ar
According to the initial values you are showing then the only logical conclusion is that your add_on assignment is not being run or your initial assignments are note being run.


Our new web site:Westmarch Studios
Re: Creating row of panels in runtime [Re: Gordon] #274170
06/25/09 22:46
06/25/09 22:46
Joined: Oct 2008
Posts: 67
C
Crypton Offline OP
Junior Member
Crypton  Offline OP
Junior Member
C

Joined: Oct 2008
Posts: 67
ˇhmm interesting. I tested it this way. It's actually a little modification to my reload() function.

Code:
function reload()
{
cartridge = arr[g_type][1]; //assign a value from array to predefined var
   if (cartridge > 0) //Test this value
   {

   add_on = (arr[g_type][0] - bullets); //calculate add on

      if (cartridge < add_on)
      { 
      add_on = cartridge;
      }
      
      cartridge -= add_on;
[..]



NOW, if I change arr[g_type][1] f.i 56 and arr[g_type][0] to 5, resulting:

Code:
[...]
cartridge = 56; //assign a value to predefined var
   if (cartridge > 0) //Test this value
   {

   add_on = (5 - bullets); //calculate add on

      if (cartridge < add_on)
      { 
      add_on = cartridge;
      }
      
      cartridge -= add_on;
[..]



, everything Works! I assume that array values aren't taken.
tested in that way too:

Code:
STRING* str_addon = "";

TEXT* dbg_count =
{
   pos_x = 0;
   pos_y = 100;
   string("add_on: ", str_addon);
   flags = SHOW;
}

function main()
{
[..]

   while(1)
   {
   [..]
   str_for_num(str_addon, arr[0][1]); // directly trying to get value! the result should be 30
   }

[..]
}



BUT the showed string is still 0!


New into Gamestudio and eager to learn it..
Stuff and games done in 2D: LINK
Re: Creating row of panels in runtime [Re: Crypton] #274198
06/26/09 01:18
06/26/09 01:18
Joined: Aug 2003
Posts: 902
Van Buren, Ar
Gordon Offline
User
Gordon  Offline
User

Joined: Aug 2003
Posts: 902
Van Buren, Ar
Then it looks like that you are note initializing the values as you think you are.


Our new web site:Westmarch Studios
Re: Creating row of panels in runtime [Re: Gordon] #274204
06/26/09 02:06
06/26/09 02:06
Joined: Feb 2008
Posts: 3,232
Australia
EvilSOB Offline
Expert
EvilSOB  Offline
Expert

Joined: Feb 2008
Posts: 3,232
Australia
Try defining your array and filling its content this way, I know this works.
Code:
var arr[2][2];   //Define multidimesnional array, with 2 columns and 2 row..

var init_array_startup()   //Giving values to addresses
{
   arr[0][0] = 5; 
   arr[0][1] = 30; 
   arr[1][0] = 10;
   arr[1][1] = 50;
}




"There is no fate but what WE make." - CEO Cyberdyne Systems Corp.
A8.30.5 Commercial
Re: Creating row of panels in runtime [Re: EvilSOB] #274235
06/26/09 08:07
06/26/09 08:07
Joined: Oct 2008
Posts: 67
C
Crypton Offline OP
Junior Member
Crypton  Offline OP
Junior Member
C

Joined: Oct 2008
Posts: 67
works!

Tried to search in manual for some explanation:

Functions ending with ..._startup are executed right after the main() function, and LC before the engine and video device is initialized. This way, every script can have its own startup function which initializes its variables or objects.


So If I want to initialize some multidimensional array again, I should use .._startup to make sure it sets its variables. Have to do this then every time I want to set array values or there is some other variables when I should use _startup?


New into Gamestudio and eager to learn it..
Stuff and games done in 2D: LINK
Page 2 of 3 1 2 3

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