Help with syntax for an if/while statement involving simultaneous note events.

Options
Alcot60890
Alcot60890 Member Posts: 17 Member
edited May 2022 in Scripting Workshop

First, sorry about the code below. The paragraph/code bIock isn't showing up for me on the highlighted text.

For my question... I want to have a group allowed/disallowed when a pair of keyswitches are pressed and have a button reflect that change. I have things working fine with 1 keyswitch as follows...

---------------------------------

if ($btn_001 = 0)
  while ($EVENT_NOTE = $keyswitch1)
    $btn_001 := 1
    $grp_001_active := 1  
  end while
end if

if ($btn_001 = 1)
  while ($EVENT_NOTE = $keyswitch1)
    $btn_001 := 0
    $grp_001_active := 0  
  end while
end if

---------------------------------

But the following doesn't seem to work. I also tried nesting a while within a while to no avail...

---------------------------------

if ($btn_001 = 0)
  while ($EVENT_NOTE = $keyswitch1 and $EVENT_NOTE = $keyswitch2)
    $btn_001 := 1
    $grp_001_active := 1  
  end while
end if

if ($btn_001 = 1)
  while ($EVENT_NOTE = $keyswitch1 and $EVENT_NOTE = $keyswitch2)
    $btn_001 := 0
    $grp_001_active := 0  
  end while
end if

---------------------------------

Any thoughts on the proper syntax in this case?

Answers

  • Alcot60890
    Alcot60890 Member Posts: 17 Member
    edited April 2022
    Options

    I read that post a half dozen times before posting. Still not seeing that paragraph icon. Pasted the code. Selected it. Nothing. Is it working for you? I tried both Chrome and Brave.

  • EvilDragon
    EvilDragon Moderator Posts: 1,023 mod
    edited April 2022
    Options

    Yes it works here. You need to scroll up a bit, the icon (stupidly) shows in the middle of the selected area, which is going to be off-screen if you paste a lot of code.

    As for your issue, you probably want to use %KEY_DOWN instead of a while loop.

  • Alcot60890
    Alcot60890 Member Posts: 17 Member
    Options

    Much appreciated! I will investigate %KEY_DOWN. As for the code block, I've still had no luck lol. I've tried 3 browsers and 2 PCs and still no sign of that damn paragraph icon. Lots of code... a little code.. doesn't matter. I've read your "how to paste code..." post over and over again, trying to unearth some hidden clue like I'm solving a puzzle in the Dvinci Code. I'm starting to think I'm being gaslit by the forum software. 🤣 Oh well, thanks again and be well. :)

  • EvilDragon
    EvilDragon Moderator Posts: 1,023 mod
    Options

    Oh, it seems this is really the case currently. Something got disabled in the forum back end I suppose. Reporting this to @Matt_NI.

  • Alcot60890
    Alcot60890 Member Posts: 17 Member
    Options

    Right on 👍️

  • corbo-billy
    corbo-billy Member Posts: 89 Helper
    Options


    Here, at home with Firefox, the same for the paragraph icon .

  • Kaiwan_NI
    Kaiwan_NI Administrator Posts: 2,683 admin
    Options

    Sorry folks, a little bit of hiccup on our side. This is fixed now. The paragraph icon should now be displayed and a code block is now possible again.

  • corbo-billy
    corbo-billy Member Posts: 89 Helper
    Options

    Ok, it's work fine, now _ 😎

  • Kaiwan_NI
    Kaiwan_NI Administrator Posts: 2,683 admin
    Options

    Hi @EvilDragon the codeblock is now displayed correctly. Do you mind helping Alcot60890 with their syntax above?

  • EvilDragon
    EvilDragon Moderator Posts: 1,023 mod
    Options

    Already did!

Back To Top