Int, var, string... THEY MAKE ME CRAZY!!! :S (SOLVED)

Started by A�rendyll (formerly Yurina), Thu 30/03/2006 13:53:29

Previous topic - Next topic

A�rendyll (formerly Yurina)

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
Yuna: Give me a Y!
Rikku: Give me an R!
Paine: Give me a break...
~Final Fantasy X-2

I've been

scotch

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.

GarageGothic

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).

Ashen

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 (but not much more detail, as the replies so far are pretty much copied from there), and you might find this BFAQ entry useful as well.
I know what you're thinking ... Don't think that.

A�rendyll (formerly Yurina)

Thanks! I really appreciate this!

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

~Yurina
Yuna: Give me a Y!
Rikku: Give me an R!
Paine: Give me a break...
~Final Fantasy X-2

I've been

SMF spam blocked by CleanTalk