Author Topic: if help (resolved)  (Read 5602 times)

bionictoothpick

  • Sr. Member
  • ****
  • Posts: 320
  • He who laughs lasts.
    • View Profile
if help (resolved)
« 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?
« Last Edit: March 25, 2016, 05:16:21 AM by bionictoothpick »

omegaman

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 880
    • View Profile
Re: if help
« Reply #1 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.   

bionictoothpick

  • Sr. Member
  • ****
  • Posts: 320
  • He who laughs lasts.
    • View Profile
Re: if help
« Reply #2 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...
« Last Edit: March 25, 2016, 05:17:29 AM by bionictoothpick »

omegaman

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 880
    • View Profile
Re: if help (resolved)
« Reply #3 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


bionictoothpick

  • Sr. Member
  • ****
  • Posts: 320
  • He who laughs lasts.
    • View Profile
Re: if help (resolved)
« Reply #4 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.