More problems... but with cool_thing!

Started by Mosk, Fri 23/07/2004 17:15:53

Previous topic - Next topic

Mosk

Hey I'm having another problem, when I start the scripting...
when I try to give multiple actions to a hotspot, ags doesn't recognise the last step, for example:
// script for hotspot4: Look at hotspot
int cool_thing;
if (cool_thing == 0) {
  Display("The TV is off.");
}
if (cool_thing == 1) {
  Display("You can see your reflection.");
}
if (cool_thing == 2) {
  Display("Your reflection is sexy!");
}
if (cool_thing == 3) {
  Display("You can't see anything else.");
}
if (cool_thing < 3) {
  cool_thing +=;
}

I took this example from here, but the problem is that ags doesn't recognise the last parameter (cool_thing +0;) when I write that, Ags cant compile the room, so, i'd like to know how can I fix that! ;D
Remember to visit http://satchplace.co.nr There are a lot of cool things!

Darth Mandarb

DISCLAIMER: I'm no expert

What about :
if (cool_thing < 3) {
cool_thing ++;
}

eric_sp

(i am not an expert, okay?)

you see, when you start playing the game, you're not going to stand by the tv all the time, clicking on it, right? by the fourth click you give on it, you should get bored of clicking on the tv. so when you click the tv more then the 3 times, a message should be shown, something like "Don't you get tired of looking the tv?!".

I guess then, that you should do something like this:
if (cool_thing == 4) {
  Display("Hey! Didn't you get bored yet. Stop it!");
}

otherwise, you might wat to make a loop, but i'm not sure how to do that.
as cool_thing is as a variable, you should try to set the var back to 0, by the fourth click:
if (cool_thing == 4) {
  cool_thing = 0; {
    Display("The TV is off.");
}
}

i didn't get why the "<3", if you already set the options for 0, 1 and 2, that are the only int options for anything minor then three.
also, i didn't understand why the "+=" without any number (for example: "+= 4"). the operand "+=" adds something to the variable, and "-=" subtracts.

i hope i helped to clear up things for you.

eric_sp

okay, i was looking at the tutorial right now, and i got what is wrong in your script.

take a look at your script:
if (cool_thing < 3) {
  cool_thing +=;
}

now what it should be:
if (cool_thing < 3) {
  cool_thing += 1;
}

the first time you click the tv, cool_thing will be on zero. it's minor then three. so it adds one to cool_thing. so with the first click, you display the message, and also, adds 1 to cool_thing. got it?
but when you click it by the fifth time, cool_thing will be already more then three, and so, he won't add anything to cool_thing. this means that, for the 6th, 7th, 8th... click on the tv, he won't add nothing on the variable, and so, cool_thing will be equal to 3, and so he'll always show the last message.

Mosk

Hey thanks a lot for your help ::)... i'll try to do what you told me!!!! :)
Remember to visit http://satchplace.co.nr There are a lot of cool things!

SMF spam blocked by CleanTalk