[SOLVED] Having problem with event: "Use inventory on Character"

Started by beenf, Sun 03/04/2011 13:03:26

Previous topic - Next topic

beenf

I want cVamp to start a different Dialog than he did when the door was closed.

I tried to figure how it works out myself, but failed
this is what I tried
Code: ags
function cVamp_Talk()
{
if object(0).Visible=true dVamp1.Start();
else if object(0).Visible=false dVamp.Start();

}

TomatoesInTheHead

Quote from: beenf on Sun 03/04/2011 19:36:31
this is what I tried
Code: ags
function cVamp_Talk()
{
if object(0).Visible=true dVamp1.Start();
else if object(0).Visible=false dVamp.Start();
}


What are the error messages you got there? Not of any help?

- object is an array, its members are accessed with [], not ()
- comparisons are done with ==, a single = is only used to assign values
- conditions are enclosed in (), "if (object[0].Visible == true) dVamp1.Start();" ("== true" can be omitted here)

(all things you already did correct in the previous posts, why change it for the worse ;))

beenf

I get this: GlobalScript.asc(576): Error (line 576): expected '('
even if i changed my ()'s to []'s and "=" to "=="

Code: ags
function cVamp_Talk()
{
if object[0].Visible == true dVamp1.Start();
else if object[0].Visible == false dVamp3.Start();

}


TomatoesInTheHead

Yeah, read my post again... the error message gives the right hint. :)

beenf

I'm sorry, but I still don't get it.
It's like there's a "(" which does not fit in the code. But I can't seem to find which one is it.
Edit: Or does it need an extra "("

Matti

You need to put () around the conditions:

if (object[0].Visible == true) dVamp1.Start();
else if (object[0].Visible == false) dVamp3.Start();


Matti

Yeah well, line 577 obviously is further down in your script. If we're supposed to help you, you should post the relevant code snippet.

beenf

Ohh, that was the case. I tought it was something about the same lane, cause when I clicked the error it would highlight the 527th line

SMF spam blocked by CleanTalk