ItsMods

Full Version: My science project
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2
I saw this post that @SuperNovaAO made:

(09-01-2011, 18:51)SuperNovaAO Wrote: [ -> ]
C++ Code
  1. while (int(bar) != bar) {
  2. bar = 10 * bar;
  3. }


To get 0 digits after the . after cutting the front of.

And yes, this is probably still faster than string manipulation since string manipulation the slowest thing possible is for computers (computers are made to calculate, not read).

and I was like
[Image: 9763578.jpg]

So I decided to use
C++ Code
  1. numfunc(num)
  2. {
  3. num += " ";
  4. num = StrTok(num,".");
  5. return int(num[1]);
  6. }

On a X number of variables to see what happens.

But I couldn't use a simple for loop ingame because the game would recognize it as an infinite loop. So I wrote a simple C# program that made a lot of variables (source here, without the forms).
I first tried it with 1000 variables, and that went fine. Then I stepped it up a notch or two and tried 100k variables. Now the map wouldn't load because the filesize was over 9000kb. Error:
Code:
Hunk_AllocateTempMemoryHigh: failed on 10022177 bytes (total 5 MB, low 0MB, high 9MB)
Then I tried 50k (or something), the file size was now less then 5MB so it could load... OR NOT. A new error appeared:
Code:
exceeded maximum number of script strings
Then finally I tried 10k and it worked, the file size was only a bit over 900kb. According to game time it finished in less then a millisecond.

Conclusion: The game doesn't care about resources used, or how they are used. Gsc files are safe enough to use anything you want, you don't have to care about performance. You just have to be careful that your gsc doesn't exceed the 5MB limit and that it doesn't use/set too many strings.
Final file: http://cfgfactory.com/kc/pozzuh/20kcode.gsc (it was too big to put on pastebin)

The attached file is the program I made to make the big file. You can change how many arrays and values per array in the program.

Awesome
In english what does that do?
(09-04-2011, 20:35)Scripts18 Wrote: [ -> ]In english what does that do?

Make a lot of variables
(09-04-2011, 20:39)Pozzuh Wrote: [ -> ]
(09-04-2011, 20:35)Scripts18 Wrote: [ -> ]In english what does that do?

Make a lot of variables

For?

(I challenge you to explain it to me)
(09-04-2011, 20:41)Scripts18 Wrote: [ -> ]
(09-04-2011, 20:39)Pozzuh Wrote: [ -> ]
(09-04-2011, 20:35)Scripts18 Wrote: [ -> ]In english what does that do?

Make a lot of variables

For?

(I challenge you to explain it to me)

read the fucking topic
Confused what does strTok do?
Pozzuh I read it but its like chinesse for me
@AZUMIKKEL Splits up the string (first parameter) with a character (second parameter) and puts it in an array
Awesome
Pages: 1 2