Page 1 of 1

Exception when running script

Posted: Sun Aug 21, 2016 6:09 pm
by rscott6666
I am trying to create a voice control script for Star Citizen but it always crashes when i say a certain phrase. other phrases work fine.

This exception shows up in the log file...

Any ideas?

8/21/2016 8:01:12 PM - System.Reflection.TargetInvocationException - Exception has been thrown by the target of an invocation.:
at System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor)
at System.Reflection.RuntimeMethodInfo.UnsafeInvokeInternal(Object obj, Object[] parameters, Object[] arguments)
at System.Delegate.DynamicInvokeImpl(Object[] args)
at System.Speech.Internal.AsyncSerializedWorker.WorkerProc(Object ignored)
at System.Threading.QueueUserWorkItemCallback.WaitCallback_Context(Object state)
at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
at System.Threading.QueueUserWorkItemCallback.System.Threading.IThreadPoolWorkItem.ExecuteWorkItem()
at System.Threading.ThreadPoolWorkQueue.Dispatch()
at System.Threading._ThreadPoolWaitCallback.PerformWaitCallback()
System.Collections.Generic.KeyNotFoundException - The given key was not present in the dictionary.:
at System.Collections.Generic.Dictionary`2.get_Item(TKey key)
at FreePIE.Core.Plugins.SpeechPlugin.<EnsureRecognizer>b__0(Object s, SpeechRecognizedEventArgs e)
at System.Speech.Recognition.SpeechRecognitionEngine.SpeechRecognizedProxy(Object sender, SpeechRecognizedEventArgs e)

Re: Exception when running script

Posted: Mon Aug 22, 2016 2:05 am
by CyberVillain
This is the line that fails.

https://github.com/AndersMalmgren/FreeP ... gin.cs#L90

Why it does that is strange, please provide script and which sentence that fails

Re: Exception when running script

Posted: Mon Aug 22, 2016 4:36 am
by rscott6666
Thank you for your time. After reading your attempts at a VR game (which i appreciate because i have a vive), i didn't think I would get an answer.

Anyhow, the sentence is "computer, increase power to front shield". I'd be curious what the error is because it almost seems like a key collision sort of thing.

Re: Exception when running script

Posted: Wed Aug 24, 2016 12:26 pm
by FrenchyKiel
impossible to read script without tab.. put the py script

Re: Exception when running script

Posted: Wed Aug 24, 2016 1:40 pm
by rscott6666
Not sure you mean. Convert spaces to tabs? Upload as a .py file?

Re: Exception when running script

Posted: Fri Aug 26, 2016 4:52 am
by FrenchyKiel
In python script tab is important to delimit if, def and so on... so the py file keep tab .. in the txt file..all tab are lost...

Re: Exception when running script

Posted: Sun Aug 28, 2016 4:26 pm
by rscott6666
Sorry, didn't realize people 7z'd the scripts before uploading them.

Re: Exception when running script

Posted: Mon Aug 29, 2016 12:35 pm
by FrenchyKiel
no file inside?

Re: Exception when running script

Posted: Mon Aug 29, 2016 6:32 pm
by rscott6666
Strange. It seems like theres a file in there to me. Can anyone else confirm one way or the other?

Re: Exception when running script

Posted: Thu Oct 13, 2016 4:44 am
by MarijnS95
FrenchyKiel wrote:In python script tab is important to delimit if, def and so on... so the py file keep tab .. in the txt file..all tab are lost...
No and no.

In python, only the indentation level is important. You may even achieve this by mixing tabs and spaces, but you need to keep it consistent throughout the entire block (if you use " \t " in the entire block, that's fine). Sub-blocks (eg. an if statment in a def) may have a completely different indentation, as long as the beginning of the indentation matches that of the parent block:

Code: Select all

def foo():
 \t if True:
 \t \t\t    \tprint("bar")
 \t \t\t    \tbarFunc()
 \t print("yup")
This doesn't mean that it makes your code any more readable, so please refrain from using such weird structures :D

Anyway, a txt file doesn't just magically lose characters. All the indentation is still there. However, it's a bit messy; you're mixing 2-space indents and 4-space indents. Like I explained above that works completely fine, but it doesn't make the code readable or consistent.

The code doesn't crash on my side - that sentence is correctly registered. Tested in FreePIE 1.9.629.0 (latest version) and my own build from master. Perhaps check if you have the latest version?

(Yes, I know this is late. Still hope it helps you out though.)