Jump to content

Home

Conditional script question


Ferc Kast

Recommended Posts

I made a custom conditional script (which I've tested & seen that it functions properly) the other day. Before my question, I'll post my original script.

 

int StartingConditional()
{

   [color="Cyan"]int iAppearance = GetScriptParameter(1);[/color]

   if ( GetAppearanceType([color="SkyBlue"]OBJECT_SELF[/color]) == [color="Cyan"]iAppearance[/color] ) return TRUE;

   return FALSE;

}

 

For a certain dialog in a TSL mod I'm doing, I want it to return true if OBJECT_SELF's appearance is P1, P2 or P3. Can anyone show me how I would do that? I would very much appreciate it.

Link to comment
Share on other sites

Hi, you're on the right track. :)

 

Here's an explicit way of phrasing the code:

int StartingConditional()
{

   int iAppearance1 = GetScriptParameter(1);
   int iAppearance2 = GetScriptParameter(2);
   int iAppearance3 = GetScriptParameter(3);
   if ( GetAppearanceType(OBJECT_SELF) == iAppearance1 ) return TRUE;
   if ( GetAppearanceType(OBJECT_SELF) == iAppearance2 ) return TRUE;
   if ( GetAppearanceType(OBJECT_SELF) == iAppearance3 ) return TRUE;
   return FALSE;

}

 

Or if you want to scrunch it down:

int StartingConditional()
{
   int iAppearanceSelf = GetAppearanceType(OBJECT_SELF);
   return   (iAppearanceSelf == GetScriptParameter(1) ) ||
            (iAppearanceSelf == GetScriptParameter(2) ) ||
            (iAppearanceSelf == GetScriptParameter(3) );
}

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...