Author Topic: Need some help with code  (Read 1522 times)

gorgo

  • Guest
Need some help with code
« on: February 25, 2019, 05:52:57 AM »
hi.
Im trying to track firegroup in Elite Dangerous by using 3 VA commands.
1) reset variables used in firegroups commands
2) weapons (jump to selected firegroup
3) collect mats (jump to another firegroup.

ctrl+m chooses next firegroup    ctrl+n chooses previous  firegroup.

1)&2) seemes to work.
3) doesnt work.

Latest: hm, could it have something to do with the exit at the endcondition part? Ill check.


1) reset variables:
Code: [Select]
Start VoiceAttack listening
Set integer [fgroup] value to 1 (save value to profile)
Set Boolean [mode] to False (save value to profile)
Set Boolean [hpoint] to False (save value to profile)
Stop VoiceAttack listening



2) weapons (jump to selected firegroup
Code: [Select]
Start VoiceAttack listening
Set integer [nos] value to 0
Set integer [mto] value to 6
Begin Integer Compare : [fgroup] Is Less Than [mto]
    Set integer [nos] value to the converted value of {EXP: {INT:mto} - {INT:fgroup}}
    Start Loop : Repeat [nos] Times
        Press Left Ctrl+M keys and hold for 0.05 seconds and release
        Pause 0.125 seconds
        Set integer [fgroup] value to the value of [mto] (save value to profile)
    End Loop
    Write [Blue] '{INT:fgroup}' to log
End Condition - Exit when condition not met
Begin Integer Compare : [fgroup] Is Greater Than [mto]
    Set integer [nos] value to the converted value of {EXP: {INT:fgroup} - {INT:mto}}
    Start Loop : Repeat [nos] Times
        Press Left Ctrl+N keys and hold for 0.05 seconds and release
        Pause 0.125 seconds
        Set integer [fgroup] value to the value of [mto] (save value to profile)
    End Loop
End Condition - Exit when condition not met
Set integer [nos] value to 0
Stop VoiceAttack listening

3) collect mats (jump to another firegroup.

Code: [Select]
Start VoiceAttack listening
Set integer [nos] value to 0
Set integer [mto] value to 3
Begin Integer Compare : [fgroup] Is Less Than [mto]
    Set integer [nos] value to the converted value of {EXP: {INT:mto} - {INT:fgroup}}
    Start Loop : Repeat [nos] Times
        Press Left Ctrl+M keys and hold for 0.05 seconds and release
        Pause 0.125 seconds
        Set integer [fgroup] value to the value of [mto] (save value to profile)
    End Loop
End Condition - Exit when condition not met
Begin Integer Compare : [fgroup] Is Greater Than [mto]
    Set integer [nos] value to the converted value of {EXP: {INT:fgroup} - {INT:mto}}
    Start Loop : Repeat [nos] Times
        Press Left Ctrl+N keys and hold for 0.05 seconds and release
        Pause 0.125 seconds
        Set integer [fgroup] value to the value of [mto] (save value to profile)
    End Loop
End Condition - Exit when condition not met
Set integer [nos] value to 0
Stop VoiceAttack listening

Pfeil

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 4782
  • RTFM
Re: Need some help with code
« Reply #1 on: February 25, 2019, 10:04:21 AM »
Neither 2 nor 3 should work correctly, as you're exiting the command as soon as the condition check returns false, meaning the second block and anything after it will never be reached.

I don't know why you're using the "Exit when condition not met" option at all, as you clearly want to execute actions after these conditional blocks.


Use "Else If" instead(VoiceAttackHelp.pdf page 64).

gorgo

  • Guest
Re: Need some help with code
« Reply #2 on: February 26, 2019, 01:07:12 AM »
Neither 2 nor 3 should work correctly, as you're exiting the command as soon as the condition check returns false, meaning the second block and anything after it will never be reached.

I don't know why you're using the "Exit when condition not met" option at all, as you clearly want to execute actions after these conditional blocks.


Use "Else If" instead(VoiceAttackHelp.pdf page 64).

thank you