VoiceAttack
Profiles, Commands and Plugins => Profile and Command Discussions => Topic started by: stabby_dave on April 19, 2021, 11:14:54 AM
-
Hi.
I'm writing a script (lets call it "ModuleFitted")to be used for ED as a callable object by other scripts. The script will be used in the format: "if ModuleFitted then...". You pass it a parameter ie "docking computer" and, if fitted, it'll return a value of true, else false.
I've got the code already written and I know how to pass the parameter to the script, but how do I get a true/false value back from it? All I can think of is to have the script set a global bool to show the result. It'll work, but ideally, I'd like it to pass the parameter back directly.
Is this even possible? If so, how do I do it?
Cheers.
-
"script"? Are you referring to a VoiceAttack command?
If you're using the "Execute Another Command" action to call that command as if it were a function, you can use command-shared scope variables (prefixed with ">>") to return any values you need, as they will be available in the calling command, provided you enable the "Wait until this command completes before continuing" option for that action.
-
Yes, it's a VoiceAttack command.
Command scoped variables are my fallback position. If I use them, the syntax would be along the lines of "call command", then "check result". If I can get the called command to pass it back, either directly or by reference, I can do "if 'command' = true". That's (for me) is a more preferable way of doing it, but if it isn't possible, then at least I can still do what I intended.
-
Commands can't directly return a value in that sense, no.
-
Ok. Thought that might be the case.
Thanks for the help. :)