Author Topic: Alright, it's time to ask for help again! Intergers  (Read 7557 times)

KuruptU4Fun

  • Guest
Alright, it's time to ask for help again! Intergers
« on: July 03, 2016, 07:31:24 PM »
Ok, now I'm working on a varied set of responses for an Eject command. Do the keystrokes that activate ejecting need to come before or after the integer below (and is what I have below correct?

Set integer [ejectresponsevalue] value as random from 1 to 3
Begin Small Integer Compare: [ejectresponsevalue] Equals 1
Play Sound
End Condition - Exit when met
Begin Small Integer Compare: [ejectresponsevalue] Equals 2
Play Sound
End Condition - Exit when met
Begin Small Integer Compare: [ejectresponsevalue] Equals 3
Play Sound
End Condition - Exit when met
End Condition

Gary

  • Administrator
  • Hero Member
  • *****
  • Posts: 2832
Re: Alright, it's time to ask for help again! Intergers
« Reply #1 on: July 03, 2016, 10:13:46 PM »
Looks correct.  You have a spurious, 'end condition' at the end, but that shouldn't matter.

The beta (final release coming this week, hopefully) has, 'else if' in it if you want to take a look:

If ejectresponsevalue equals 1
   Play some sound
else if ejectresponsevalue equals 2
   Play some other sound
else if ejectresponsevalue equals 3
   Play yet another sound
else
   Play the default sound
end if

Makes it slightly more cleaner and easier than the old way ;)

J. Calvert (Joshua)

  • Newbie
  • *
  • Posts: 30
Re: Alright, it's time to ask for help again! Intergers
« Reply #2 on: July 03, 2016, 11:49:37 PM »
And it doesn't make a difference where you put the keystrokes that activate ejecting. Depends on what is said in the soundbites ("ejecting cargo now" or "cargo ejected") or if the ejecting is time critical or not. If, for example, I make a command for Power to shields I want the key pressed as soon as possible so I put the keypress first and the soundbite second.

KuruptU4Fun

  • Guest
Re: Alright, it's time to ask for help again! Intergers
« Reply #3 on: July 04, 2016, 03:49:31 PM »
Thanks guys, how does this look?

Set integer [variablesoundseject] value as random from 1 to 6
Begin Integer Compare : [variablesoundseject] Equals 1
    Play sound, '{VA_SOUNDS}\VA Sounds Salli\Ship\Components\Cockpit\Activating Ejection Salli.mp3'  (and wait until it completes)
Else If Integer Compare : [variablesoundseject] Equals 2
    Play sound, '{VA_SOUNDS}\VA Sounds Salli\Ship\Components\Cockpit\Ejecting Pilot Salli.mp3'  (and wait until it completes)
Else If Integer Compare : [variablesoundseject] Equals 3
    Play sound, '{VA_SOUNDS}\VA Sounds Salli\Ship\Components\Cockpit\Ejecting Salli_0001.mp3'  (and wait until it completes)
Else If Integer Compare : [variablesoundseject] Equals 4
    Play sound, '{VA_SOUNDS}\VA Sounds Salli\Ship\Components\Cockpit\Goodbye Salli.mp3'  (and wait until it completes)
Else If Integer Compare : [variablesoundseject] Equals 5
    Play sound, '{VA_SOUNDS}\VA Sounds Salli\Ship\Yes-No\Ackno Salli_0001.mp3'  (and wait until it completes)
Else If Integer Compare : [variablesoundseject] Equals 6
End Condition - Exit when condition met




« Last Edit: July 04, 2016, 07:35:48 PM by KuruptU4Fun »

J. Calvert (Joshua)

  • Newbie
  • *
  • Posts: 30
Re: Alright, it's time to ask for help again! Intergers
« Reply #4 on: July 05, 2016, 01:55:15 AM »
Looks fine to me and it's the way i used to do it myself.  It's a good way to get to know the random feature and using variables but have you seen the "Play a random sound" command. It's easier to setup, just select the soundbites you want to use and VA picks one at random.

Nekora

  • Guest
Re: Alright, it's time to ask for help again! Intergers
« Reply #5 on: July 14, 2016, 11:31:20 PM »
I would just like to point out from the original post, that if you use "end condition - exit when condition met" the keystrokes to eject will have to come first as that exit will stop the command before VA presses a key if you have the keystrokes at the end.

Also you can simplify it all in the beta (maybe the full release? i dont use that but current beta should become full release shortly if no major bugs are discovered) by other>sounds>play a random sounds
that way you would not need to mess around with intergers or conditionals at all it would be as simple as

Play a random sound (3 items)
Press E Key for 0.03 seconds and release

Gary

  • Administrator
  • Hero Member
  • *****
  • Posts: 2832
Re: Alright, it's time to ask for help again! Intergers
« Reply #6 on: July 18, 2016, 06:00:25 PM »
You don't need the beta for the random sounds... it's been in there for a very long time ;)