Two Events While with one note

Discussion in 'Scripting Workshop' started by mxoliveira73, Feb 15, 2020.

  1. mxoliveira73

    mxoliveira73 New Member

    Messages:
    6
    I need run two While loops when tape one note. For exemplo, taping C1 two while loops run...
    on note
    {taping C1}

    if($EVENT_NOTE = 12)
    while ($NOTE_HELD = 1)
    play_note (50, $EVENT_VELOCITY, 0, $DURATION_QUARTER / 2)
    wait ($DURATION_QUARTER/2)
    end while
    end if


    if($EVENT_NOTE = 12)
    while ($NOTE_HELD = 1)
    play_note (75, $EVENT_VELOCITY, 0, $DURATION_QUARTER / 4)
    wait ($DURATION_QUARTER/4)
    end while
    end if

    end on

    is it Possible?
    Thanks...
     
  2. EvilDragon

    EvilDragon Moderator Moderator

    Messages:
    15,873
    Not like that it isn't, because KSP is procedural, stuff is processed from top to bottom. You should look into using listener callback for this. There's threads here talking about it, do a forum search.
     
  3. mxoliveira73

    mxoliveira73 New Member

    Messages:
    6
    ok. I understand and I will try it..
    Thanks!!!
     
  4. mxoliveira73

    mxoliveira73 New Member

    Messages:
    6

    Well, it's don't solve my problem... The code bellow works fine, but, I have play 2 notes... There's a way to simulate that note 50 (for example) is playing... Then, i will play 1 note and simulate that other is playing to... oe something like that...

    on note

    if($EVENT_NOTE =50)
    ignore_event($EVENT_ID)
    while ($NOTE_HELD = 1)
    play_note ($EVENT_NOTE, $EVENT_VELOCITY, 0, $DURATION_QUARTER / 2)
    wait ($DURATION_QUARTER)
    end while
    end if


    if($EVENT_NOTE =56)
    ignore_event($EVENT_ID)
    while ($NOTE_HELD = 1)
    play_note ($EVENT_NOTE, $EVENT_VELOCITY, 0, $DURATION_QUARTER / 2)
    wait ($DURATION_QUARTER)
    end while
    end if

    end on