PDA

View Full Version : [TSL] My conditional scripting woes


Robespierre
06-22-2008, 03:29 AM
Well, I've tried and tried to get this conditional script to work, but for all my efforts, I get nothing. The dialog option is there regardless of whether or not the item is in my inventory. Here's the script:

int StartingConditional() {

{
GetIsObjectValid(GetItemPossessedBy(GetFirstPC(), "pl_visa"));
return TRUE;
}
return FALSE;

}

Can someone help me out?

Gavroche
06-22-2008, 05:40 AM
So the dialogue option must show up if pl_visa is in your inventory?

int StartingConditional() {

if(GetIsObjectValid(GetItemPossessedBy(GetFirstPC( ), "pl_visa")))
{
return TRUE;
}
else {return FALSE}

}

This should work... Basically, in your script, you ask for a condition ("Does my PC have pl_visa with him?"), but you don't use the result of this condition. You directly tell it to "return TRUE". That's the way I understand it anyway. Tell me if it worked!

stoffe
06-22-2008, 06:57 AM
Well, I've tried and tried to get this conditional script to work, but for all my efforts, I get nothing. The dialog option is there regardless of whether or not the item is in my inventory. Here's the script:


Your script is always returning TRUE since the first return statement isn't wrapped inside any conditional check. Either use an if-statement, or return the result from your item check directly. Like:


int StartingConditional() {
return GetIsObjectValid(GetItemPossessedBy(GetFirstPC(), "pl_visa"));
}

Robespierre
06-23-2008, 02:23 AM
Ah wonderful. Thanks for the help.