Adventure Game Studio

AGS Support => Advanced Technical Forum => Topic started by: Wonkyth on Tue 12/05/2009 13:53:37

Title: Error
Post by: Wonkyth on Tue 12/05/2009 13:53:37
I just cut-and-pasted some code in a script module, and as soon as I had done it an error box came up containing a message telling me to post the following here:

Error: StartIndex cannot be less than zero.
Parameter name: startIndex
Version: AGS 3.1.0.60

System.ArgumentOutOfRangeException: StartIndex cannot be less than zero.
Parameter name: startIndex
   at System.String.InternalSubStringWithChecks(Int32 startIndex, Int32 length, Boolean fAlwaysCopy)
   at AGS.Editor.ScintillaWrapper.CheckFunctionForLocalVariables(Int32 currentPos, ScriptFunction func, String scriptExtract)
   at AGS.Editor.ScintillaWrapper.GetListOfLocalVariablesForCurrentPosition(Int32 currentPos)
   at AGS.Editor.ScintillaWrapper.FindLocalVariableWithName(Int32 startAtPos, String nameToFind)
   at AGS.Editor.ScintillaWrapper.GetFinalPartOfExpression(Int32 currentPos, ScriptStruct& memberOfStruct, Boolean functionsOnly)
   at AGS.Editor.ScintillaWrapper.ShowCalltip(Int32 openingBracketPos, Int32 parameterIndex, Boolean functionsOnly)
   at AGS.Editor.ScintillaWrapper.scintillaControl1_DwellStart(Object sender, DwellStartEventArgs e)
   at Scintilla.ScintillaControl.DispatchScintillaEvent(SCNotification notification)
   at Scintilla.ScintillaControl.WndProc(Message& m)
   at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
   at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
   at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)

If it helps, I might have had the game debugging at the time, but I wasn't really paying attention.
It didn't appear to doing anything other than display the exception message.
Title: Re: Error
Post by: Khris on Tue 12/05/2009 14:12:17
You should really know what you're doing before c&p-ing code from a module.
Please post the code you used.

My guess is that String.Substring(int index, int length) gets called with a starting index less than zero.
Title: Re: Error
Post by: Pumaman on Tue 12/05/2009 23:24:29
This is a bug in the AGS Editor that was fixed in 3.1.2. If you want to avoid it happening again, upgrade to AGS 3.1.2 SP1 which you can download from the website.
Title: Re: Error
Post by: Wonkyth on Wed 13/05/2009 10:35:12
Sure.
I downloaded it before, but my cruddy dial-up ruined it.
I haven't got around to downloading it again.