Dialog Problem

Started by inFERNo, Wed 20/08/2003 21:47:20

Previous topic - Next topic

inFERNo

Hello again.
Just now I ran into a dialog problem, that I just don't seem to be able to fix. It's all part of a puzzle: you must get into a moushole, that is proteted by a rat. Therefore you need to get some crumbs to get it out. You get the crumbs from a guy during a dialog.
Now when placing the crumbs, you lose them from your inventory, the rat will run there and the hole is free. But if you interact with the rat or walk onto a region close to it, it will take the crumbs and run back into it's hole. Now you need to get some crumbs again from the guy.
As soon as any of those two events happen, a var, which is defined in the header script is set to 1. When interacting with the character, it runs a script with the following code:

if (crumbs == 1) {
RunDialog(5);
}
else {
RunDialog(0);
}

Now, I don't know why, but no matter what, Dialog 0 is always run. Can anyone help me out on this?

TerranRich

Ooh. While not exactly a beginners' question, I will add this to the Beginners' FAQ anyhow.

This is in the manual, albeit hidden under "Script language keywords" as the commands import and export.

How to create and use a variable not already built in to AGS:

1. First, in the global script, declare and set the variable. The following will declare and set a variable called "health" of the integer data type...

int health;
health=100;


2. Secondly, you must export any and all variables you create, way at the very end of the global script, like so...

export health;

3. Finally, in each and every room where you will be using the above variable, go to its room script, and at the very top, before anything else, you must import the variable, like so...

import int health;

Remember! Only the import command requires the data type as well as the variable name, while the export command only needs the variable name.

Hope this helps. :)
Status: Trying to come up with some ideas...

Ginny

If I'm not mistaken, the variable can also be imported into the script header and used in any room if neccessary, correct?

Sounds like a nice puzzle :).
Try Not to Breathe - coming sooner or later!

We may have years, we may have hours, but sooner or later, we push up flowers. - Membrillo, Grim Fandango coroner

inFERNo

Thanks a bunch, terran. I found out how to do it right after I posted (and was pissed at myself for posting questions that I can answer myself after a bit more of research) using the SetGlobablInt and GetGlabalInt commands. But I'll keep in mind your technique, might come in handy at other spots.

TerranRich

Yes, I totally forgot to suggest global ints, and will do so in the BegFAQ as well. And I also have a method of creating your own "global ints" if you need more than the alloted 300 provided. :)
Status: Trying to come up with some ideas...

inFERNo

Since it's just a one-room adventure, I think 300 will be more than enough. ;)
The only limitations that kinda pissed me where the ones with the objects and hotspots. 15 objects and 19 hotspots? How's anyone supposed to call that sufficient with a one room adventure?
This just had me to do a whole lot of rearranging, when I reached the limits, meaning a whole lot more work, since I -of course- was stupid enough not to read the system limitations in the help file.
But how come this is so? Is that limited with AGS or with the engine? And what's the point? Will the game become slower when using more objects or hotspots?
I don't mean to rant, since I know this program is freeware (which is awesome) and it's developed in freetime, I just think it would be a huge inprovement to set those two limits higher, if it doesn't bring any great negative side effects...

Scummbuddy

There are many people here who, by playing your game, would complain about the drain on resources, cause too many objects on the screen would slow down the game.
- Oh great, I'm stuck in colonial times, tentacles are taking over the world, and now the toilets backing up.
- No, I mean it's really STUCK. Like adventure-game stuck.
-Hoagie from DOTT

inFERNo

#7
I'm developing and therefor testing this game on a rather old PC (for nowadays standards), but haven't experienced any significant slowdowns. But also I realised many things during the making progress that I would do differently in my next game. For example I wouldn't create my next one on 640x480 and make a room with so much interactivity, but rather sepparater in more smaller rooms, that are conected to another. But I still have the excuse that it's my first game and didn't really know what I was doing when I started with it. But I very much got into it, so I might actually join up a team or something for my next one, if I want to create something bigger.
But thanks for the information, buddy...  ;D

[EDIT]Btw, what does the T.S.I.B.H.O.D.C. stand for?[/EDIT]

Scummbuddy

read my bottom signiture.  its a quote from Calvin and Hobbes
- Oh great, I'm stuck in colonial times, tentacles are taking over the world, and now the toilets backing up.
- No, I mean it's really STUCK. Like adventure-game stuck.
-Hoagie from DOTT

inFERNo

#9
Ah, there goes another proof of my great observation and combination skills out in the world...

[EDIT]Away with this post! Getting sick of my asking questions and finding the answer if I just try a bit longer.[/EDIT]

SMF spam blocked by CleanTalk