Game authors and players, please read this thread!

Author Topic: Int, var, string... THEY MAKE ME CRAZY!!! :S (SOLVED)  (Read 475 times)  Share 

Aërendyll (formerly Yurina)

  • Back from the dead.
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
« Last Edit: 02 Apr 2006, 15:22 by Yurina »
Yuna: Give me a Y!
Rikku: Give me an R!
Paine: Give me a break...
<i>~Final Fantasy X-2</i>

I've been

scotch

  • Mittens Baronet
Re: Int, var, string... THEY MAKE ME CRAZY!!! :S
« Reply #1 on: 30 Mar 2006, 14:50 »
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.

Re: Int, var, string... THEY MAKE ME CRAZY!!! :S
« Reply #2 on: 30 Mar 2006, 15:20 »
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

Re: Int, var, string... THEY MAKE ME CRAZY!!! :S
« Reply #3 on: 31 Mar 2006, 01:17 »
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)

  • Back from the dead.
Re: Int, var, string... THEY MAKE ME CRAZY!!! :S
« Reply #4 on: 02 Apr 2006, 15:18 »
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...
<i>~Final Fantasy X-2</i>

I've been