Topic script

Started by kafka, Mon 03/04/2006 21:27:04

Previous topic - Next topic

kafka

I have a topic and a int variable. I want that, when the game has shown a dialog, it increases the int variables value.

spook1

You can call a function from a dialog by e.g.
run-script(1)

This will call script number 1.
In my example script-1 will make the player character walk to 282,185.
script number 2 will end the game.

You can add a many scripts as you like.


To implement this you must add a function in the Global script:

Code: ags

function dialog_request (int parameter) {

  if (parameter == 1) {
    cEGO.Walk(282, 185);
}

  if (parameter == 2){
		Display("GAME OVER!");
		QuitGame(0);
  }
  
} 

kafka

Thanks! How can I put variables in display: display("You have " money "$ in your pocket!");?

Khris

int money=100;
Display("You have %d & in your pocket!", money);

Oh and RTFM.

kafka

Thanks.  ;D Hmm. I have a hotspot in my room and i put in the interaction menu look a run script. How can i change the value of that variable in that room?

Radiant

Quote from: kafka on Mon 03/04/2006 22:28:00
Thanks.  ;D Hmm. I have a hotspot in my room and i put in the interaction menu look a run script. How can i change the value of that variable in that room?

You either declare the variable at the top of your room script (and it will only work in that room) or you put it in your global script, like this:
Code: ags

//top of global script
int thingy;

//bottom of global script
export thingy;

//global header file
import int thingy;


SMF spam blocked by CleanTalk