Adventure Game Studio

AGS Support => Beginners' Technical Questions => Topic started by: A�rendyll (formerly Yurina) on Thu 30/03/2006 13:53:29

Title: Int, var, string... THEY MAKE ME CRAZY!!! :S (SOLVED)
Post by: A�rendyll (formerly Yurina) on Thu 30/03/2006 13:53:29
Hello folks,

I have a question:

What are strings, vars and ints exactly? For what functions are they used? I never got what they resemble, but since I'm using AGS and programme my own game, I'm very interested in how I use them. I just can't get what they mean. ??? >.<*

I'd like a description of every function and how to apply it in a script.

For now I'm forced to use invisible inventory items to trigger events, and I'm sure there is a better way of triggering. So...

Sorry is this sounds very n00b, but I really want to know what/how/why.

~Yurina
Title: Re: Int, var, string... THEY MAKE ME CRAZY!!! :S
Post by: scotch on Thu 30/03/2006 14:50:13
int: Short for integer, just a type for containing basic whole number values.
var: Short for variable, not used anywhere in AGS.
string: A type used to hold "strings" of characters (letters), this text will be held in a string somewhere in your computer.
String: The new type of string in AGS 2.71+, similar, just easier to use.
float: Used in a similar way to int, but can hold floating point numbers, like 3.142
bool: A variable type that can only contain two logical values, true or false.

If you want to store a number somewhere you can do so in a variable of type "int", like

int myVariable;
myVariable = 30;

Read through any programming tutorial for how to use variables.
Title: Re: Int, var, string... THEY MAKE ME CRAZY!!! :S
Post by: GarageGothic on Thu 30/03/2006 15:20:00
You forgot one variable type.

char: Short for character, holds a numerical value of 0-255. Each value also represents an ASCII character (a letter, number or symbol).
Title: Re: Int, var, string... THEY MAKE ME CRAZY!!! :S
Post by: Ashen on Fri 31/03/2006 01:17:26
Actually he forgot two types, there's also:
short:  16-bit integer, can store numbers from â€"32,768 to 32,767


But the only two you'll really need to worry about are int - for numbers - and string/String (depending on what version you're using) - for letters/words.

They're explained in a little more detail in the manual (http://www.adventuregamestudio.co.uk/manual/Datatypes.htm) (but not much more detail, as the replies so far are pretty much copied from there), and you might find this BFAQ entry (http://americangirlscouts.org/agswiki/index.php/Scripting%2C_Code_%26_Interaction#Working_with_variables:_the_basics) useful as well.
Title: Re: Int, var, string... THEY MAKE ME CRAZY!!! :S
Post by: A�rendyll (formerly Yurina) on Sun 02/04/2006 15:18:43
Thanks! I really appreciate this!

Now I can finally get into scripting seriously. *grins evily* 8)

~Yurina