If troubles

Started by Michael Zhu, Tue 15/04/2003 12:36:02

Previous topic - Next topic

Michael Zhu

I've tried to input a script which has:
if ((character blah inv(10) = 1) && etc etc {
  addinventory(2);
  loseinventory(1); }

into a "interact with hotspot" interaction, the program says something like "script isn't finished, missing }" but I did have the beginning if script { and the end }.
Is it esential to have an Else command after the if one?
Where do I put the If functions in a room?
If man carried away in bodybag, say "KOMATA!" and his soul will go to Bodycount Productions.

Ishmael

if (character blah inv(10) = 1) && etc etc {
 AddInventory(2);
 LoseInventory(1); }

Try this...
I used to make games but then I took an IRC in the knee.

<Calin> Ishmael looks awesome all the time
\( Ö)/ ¬(Ö ) | Ja minähän en keskellä kirkasta päivää lähden minnekään juoksentelemaan ilman housuja.

Erica McLane

Or:
if ((character[blah].inv(10) = 1) && etc etc {
  AddInventory(2);
  LoseInventory(1);
}

scotch

Or:
if ((character[blah].inv(10) = 1) && etc etc) {
  AddInventory(2);
  LoseInventory(1);
}

it was missing a ) right?

Michael Zhu

I know the script, but where do I put it? In a hotspot? in a room script? Character Enter Screen Before/After Fade in?
If man carried away in bodybag, say "KOMATA!" and his soul will go to Bodycount Productions.

Gilbert

You must use double "=" for comparison too:

if ((character[blah].inv(10) == 1) && etc etc) {
 AddInventory(2);
 LoseInventory(1);
}

About where to put the script, it just depends on what you want it to do. We can't help you unless you give more info.

Michael Zhu

The placement isn't a problem anymore.
When I enter:
-----------------------------------------------------
if (player.inv[3] == 1 )  {
  Display("You suck!" //or whatever
}
-----------------------------------------------------
the game works fine, but when I use multiple conditions such as:
---------------------------------
if ((player.inv[3] == 1) && (player.inv[5] == 1) && (player.inv[69] == 1))  {
  Display("Sixty nine. Hehe, dirty mud.");
}
--------------------------------------------------------
AGS says something about not being able to comprehend "Nested functions" or I'm missing a } in the script, which I have checked for {s and }s several times over. Is AGS mongilated or am I doing something wrong?
If man carried away in bodybag, say "KOMATA!" and his soul will go to Bodycount Productions.

scotch

I've had that before.. it was actually because there was a } missing even if it didn't look like it.  Make sure you are looking at the entire room script rather than just the script for an interaction when you check, it's easier to see.

I think the nested funtion error is because you have missed the last } from a function so it thinks you're trying to create a new function inside the last one, which it can't do.

SMF spam blocked by CleanTalk