AGS limits

Started by swaz, Sat 11/08/2007 02:17:09

Previous topic - Next topic

swaz

Hi all,
some months ago i started using AGS, and now i've discovered the Global Ints.
Then I asked myself: why did CJ limited them to 500?
And so on, why max 299 rooms? Why 16 loops per view?
I mean, wouldn't be better if there weren't limits?
I think every VGmaker should decide for himself how to make his game long..

monkey0506

The limits were imposed based upon the memory AGS allocated. The new version of AGS in-the-works, AGS 2.8, is removing some of these limits, such as the number of GUIs allowed per game and the number of frames allowed per loop.

As for the global ints, you can use more using the import/export keywords to use your own ints throughout your scripts.

You can have 300+ rooms, but anything over 299 won't be a state-saving room meaning that every time you enter the room AGS will run the "first time player enters room" interactions. There's a module, the OtherRoom module, which is designed for affecting things in other rooms, but also saves the state of the rooms and supports up to 999 rooms.

If any of the limits poses a serious hindrance, first check the AGS 2.8 beta thread. As I said, CJ is removing a lot of the limits previously imposed by moving to more dynamic memory allocation. Check to make sure that he hasn't already removed the limit you want/need changed, and if he hasn't you can post a thread in the Technical Forum requesting the change to the limit. ;)

Recluse

I wouldn't suggest using GlobalInts, only as a personal preference. I find it much easier to set variables like so:

Code: ags

isMusician = true;


without having to call a function, like so:

Code: ags

SetGlobalInt(10,1);


Just from looking at the code it's much easier to remember what "isMusician" does, rather than trying to remember what you had "Global Int #10" do.
All your verbcoin are belong to us.

swaz

Thanks but

Quote from: Recluse on Sat 11/08/2007 03:34:17
I wouldn't suggest using GlobalInts, only as a personal preference. I find it much easier to set variables like so:

Code: ags

isMusician = true;


How to use this variable using if?
I tried "if (isMusician == true)" but i get the error "undefinited symbol isMusician"..

Lt. Smash

You must set it befoure you can get it, for sure.

bool isMusician=true;

you must write it somewhere before the if check.

or if you want a number not an bool you can use

int Number=1;
short Number=1;
...

This is very basic and I think it is written in the BFAQ and in the forum many times so search there before.

swaz

Quote from: Lt. Smash on Sat 11/08/2007 14:05:53
You must set it befoure you can get it, for sure.

bool isMusician=true;

you must write it somewhere before the if check.

or if you want a number not an bool you can use

int Number=1;
short Number=1;
...

This is very basic and I think it is written in the BFAQ and in the forum many times so search there before.

But will it remain in the game even if I change room, like GlobalInt?

Gilbert

Yes, as long as you didn't declare it inside a function.

swaz

Suggestions about where to put "bool isMusician=true;" to make it global and not to get error "undefinited symbol isMusician" in the room's script?
Thanks

Khris

Start of global script:
Code: ags
bool isMusician=true;
export isMusician;


Script header:
Code: ags
import bool isMusician;


And BAM!

swaz

I've put
Code: ags

bool isMusician=true;
export isMusician;

at the start of Global Script, and
Code: ags

import bool isMusician;

But in the room (in which there's a function which sets the variable on true) I get the error: "Already referenced name as import; you must define it before using it"

monkey0506

If you're importing it just into the one room instead of into the global header, you'll need to make sure that the import line is at the top of the room script. If you try to access it (isMusician) before the import line you'll get this error. Alternately moving it to the global header would fix it as well as making it available to all room scripts.

swaz

#11
Ehm the problem was in the function to set the bool I was using "bool isMusician=true" instead of "isMusician=true" Please don't kill me :P
Everything solved!
Thanks everybody for the answers!!! :)

Khris

If you start with the import line in the header, AGS will auto-complete the variable's name in the global script. That way you won't accidentally use different names.

swaz

I'm sure I wasn't using different names, anyway the most important fact is the problem is solved, don't trouble yourself anymore :)

monkey0506

Glad to hear the issue's resolved. Feel free to ask if you have more problems. We're (usually :P) glad to help. ;)

SMF spam blocked by CleanTalk