script size and array 'initialisation'

Ask for Help on Using the Language With Memory Hacking Software

Moderators: g3nuin3, SpeedWing, WhiteHat, mezzo

script size and array 'initialisation'

Postby mezzo » Mon Jun 04, 2007 11:06 pm

I was wondering, is there a maximum size that a script can be ?
Also, can I for instance have one script that contains all my 'multipurpose' routines/variables and use them from other scripts (as long as they are added to the script list?)

Another thing I was wondering about, when I create a 2 dimensional array, and I initialise each value to 0, the script seems to hang for a second or 2 in the middle (about halfway through the array).. I use the below to init the array..


Code: Select all
BYTE level_map[2000];
   for (int i = 0; i < 25; i++) {
      for ( int j = 0; j < 80; j++ ) {
         int index = ((i*80)+j);
         level_map[index] = 0;
         PrintF( "Array(%u,%u|%u): %u.", j, i, index, level_map[index] );
         }
   }


Any ideas what would cause this ? Or any hints on doing it better ?
- No thanks, I already have a penguin -
User avatar
mezzo
El Mariachi
 
Posts: 739
Joined: Mon Apr 30, 2007 10:27 pm
Location: Antwerp

Postby L. Spiro » Tue Jun 05, 2007 9:34 am

I was wondering, is there a maximum size that a script can be ?

No.

Also, can I for instance have one script that contains all my 'multipurpose' routines/variables and use them from other scripts (as long as they are added to the script list?)

Yes.

I use the below to init the array..

Use:
Code: Select all
BYTE level_map[2000] = { 0 };


Any ideas what would cause this ? Or any hints on doing it better ?

It is caused by trying to print every single value. PrintF() is a slow function, and slower as there is more text in the buffer.

To do it better (instantly), use the code above.
If you need to loop through it later, use your code, without PrintF().


L. Spiro
User avatar
L. Spiro
L. Spiro
 
Posts: 3129
Joined: Mon Jul 17, 2006 10:14 pm
Location: Tokyo, Japan

Postby mezzo » Tue Jun 05, 2007 4:15 pm

That does make sense :-) thanks
(I started coding in C again... will try to keep the dumb q's to a minimum :-)
- No thanks, I already have a penguin -
User avatar
mezzo
El Mariachi
 
Posts: 739
Joined: Mon Apr 30, 2007 10:27 pm
Location: Antwerp


Return to Help

Who is online

Users browsing this forum: No registered users and 0 guests

cron