Adventure Game Studio

AGS Support => Beginners' Technical Questions => Topic started by: swaz on Sat 11/08/2007 02:17:09

Title: AGS limits
Post by: swaz on Sat 11/08/2007 02:17:09
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..
Title: Re: AGS limits
Post by: monkey0506 on Sat 11/08/2007 02:51:35
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 (http://www.adventuregamestudio.co.uk/yabb/index.php?topic=20650) 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 (http://www.adventuregamestudio.co.uk/yabb/index.php?topic=31519.0). 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 (http://www.adventuregamestudio.co.uk/yabb/index.php?board=2.0) requesting the change to the limit. ;)
Title: Re: AGS limits
Post by: 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:


isMusician = true;


without having to call a function, like so:


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.
Title: Re: AGS limits
Post by: swaz on Sat 11/08/2007 13:34:42
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:


isMusician = true;


How to use this variable using if?
I tried "if (isMusician == true)" but i get the error "undefinited symbol isMusician"..
Title: Re: AGS limits
Post by: 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.
Title: Re: AGS limits
Post by: swaz on Sat 11/08/2007 14:12:50
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?
Title: Re: AGS limits
Post by: Gilbert on Sat 11/08/2007 14:19:25
Yes, as long as you didn't declare it inside a function.
Title: Re: AGS limits
Post by: swaz on Sun 12/08/2007 01:18:51
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
Title: Re: AGS limits
Post by: Khris on Sun 12/08/2007 01:20:59
Start of global script:
bool isMusician=true;
export isMusician;


Script header:
import bool isMusician;

And BAM!
Title: Re: AGS limits
Post by: swaz on Sun 12/08/2007 01:43:25
I've put

bool isMusician=true;
export isMusician;

at the start of Global Script, and

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"
Title: Re: AGS limits
Post by: monkey0506 on Sun 12/08/2007 02:28:54
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.
Title: Re: AGS limits
Post by: swaz on Sun 12/08/2007 18:57:48
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!!! :)
Title: Re: AGS limits
Post by: Khris on Sun 12/08/2007 19:59:50
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.
Title: Re: AGS limits
Post by: swaz on Sun 12/08/2007 20:27:16
I'm sure I wasn't using different names, anyway the most important fact is the problem is solved, don't trouble yourself anymore :)
Title: Re: AGS limits
Post by: monkey0506 on Mon 13/08/2007 03:55:13
Glad to hear the issue's resolved. Feel free to ask if you have more problems. We're (usually :P) glad to help. ;)