Attract-Mode Support Forum

Attract-Mode Support => Scripting => Topic started by: bionictoothpick on March 24, 2016, 07:00:55 PM

Title: if help (resolved)
Post by: bionictoothpick on March 24, 2016, 07:00:55 PM
if (3>2)
{ x code
}

works fine.


if (fe.get_input_state("Custom1")==true)
{ x code
}
x code never executes (even though I have Custom1 configured in controls and am pressing the selected button.

What am I overlooking?
Title: Re: if help
Post by: omegaman on March 24, 2016, 09:24:50 PM
Check the input_map in your attract.cfg. Then use the input_id for Custom1. For example, something like ("Joy0 Up"). In your case it would be the selected button that should be the input_id. Anyway, that's the way it's suppose to work.

Then just add a fe.add_ticks_callback for your function.   
Title: Re: if help
Post by: bionictoothpick on March 25, 2016, 05:07:27 AM
Thanks for the reply.

I have the custom1 in the cfg file set to Z.

I believe I was initially using true with quotes...

Now to get the text to remove when the button is not pressed...
Title: Re: if help (resolved)
Post by: omegaman on March 25, 2016, 05:48:05 AM
Yeah,

IF expects a boolean condition like (3>2), then the condition is evaluated. If the statement is true (3>2==true) then following statements are executed

Here is a flow chart that helps remember conditional statements. It's hard to remember this stuff, if you don't do it everyday.

IF (A=TRUE)
THEN B
ELSE C
END IF

Title: Re: if help (resolved)
Post by: bionictoothpick on March 25, 2016, 06:43:36 AM
Thanks...I've got the code working to display text only while holding the button...now just to have it to improve history text wrapping and find a spot I like for the display...hopefully I can update the magazine template tonight.

I used the forum about popup image plugin to find the sample code.