I am noob with script, so if someone know answer help.
I have 6 hotspots for 6 objects . Every hotspot works like a button, and change object graphic.
(Example- if player interact hotspot1 then the object1 change graphic to A, next time to B, next time C,then A again...).
My problem. I want to meke hotspot 7 to work like some final button which will do function only if there is a right combination of object graphic).
I tried this :
function hHotspot23_Interact()
{
if (oABCprvo.Graphic == 105)
(oABCtrece.Graphic == 107)
(oABCtrece.Graphic == 106)
(oABCcetvrto.Graphic == 107)
(o123prvo.Graphic == 103)
(o123drugo.Graphic == 102)
(o123trece.Graphic == 104)
(o123cetvrto.Graphic == 103)
{ oSemaforradi.Visible = true ;}
}
and this(with variable, where variable match right graphics):
function hHotspot23_Interact()
{
if {oABCprvo.Graphic = 105;}
(abc2 == 1)
(abc3 == 3)
(abc4 == 2)
(prvo == 2)
(drugo == 3)
(trece == 2)
(cetvrto == 3)
{ oSemaforradi.Visible = true ;}
}
This should do the trick:
function hHotspot23_Interact()
{
if ((oABCprvo.Graphic == 105) &&
(oABCtrece.Graphic == 107) &&
(oABCtrece.Graphic == 106) &&
(oABCcetvrto.Graphic == 107) &&
(o123prvo.Graphic == 103) &&
(o123drugo.Graphic == 102) &&
(o123trece.Graphic == 104) &&
(o123cetvrto.Graphic == 103))
oSemaforradi.Visible = true;
}
Remember, if you want to check multiple things in one if-statement, you have to chain them together via either && ("and") or || ("or").
Thanks for quick reply and tip about && and ||.
Game works (have no bugs) but function do nothing. I tried some other functions and same thing happen when i interact with hotspot(nothing:) ) . Thanks anyway i will try to figure something up.
Well, if your function isn't doing anything, it means that it doesn't fulfill all 8 of your requirements. You can check the by putting in an else statement with a Display() call.
~Trent
(oABCtrece.Graphic == 107) &&
(oABCtrece.Graphic == 106) &&
Considering that you're asking for oABCtrece to have two different images at the same time, this will never happen. Or did you want them all to be OR (||) instead of AND (&&)?
Quote from: Pumaman on Tue 30/12/2008 23:13:09
(oABCtrece.Graphic == 107) &&
(oABCtrece.Graphic == 106) &&
I'm guessing there's supposed to be a oABCdrugo in place of one of those.
~Trent
Yes, it was typing problem in that. Works now.
Insted
(oABCtrece.Graphic == 107) &&
(oABCtrece.Graphic == 106) &&
It should be :
(oABCdrugo.Graphic == 106) &&
(oABCtrece.Graphic == 106) &&
Thank you all guys for help. The forum is great.
Quote from: bloodymirj on Wed 31/12/2008 08:17:51
Thank you all guys for help. The forum is great.
Of course they are! And we're glad to have you here. Welcome to AGS.
~Trent
Quote from: Trent R on Wed 31/12/2008 17:25:00
Quote from: bloodymirj on Wed 31/12/2008 08:17:51
Thank you all guys for help. The forum is great.
Of course they are! And we're glad to have you here. Welcome to AGS.
~Trent
Good to know people really like some of us..That's where I come in..and destroy all happiness..and wtf am I typing?