Reader.ReadNumber()

May 6, 2012 at 8:12 PM
Edited May 6, 2012 at 9:02 PM

No pressure Squizzle. Just letting you know with the Last Subversion update this is What I'm seeing. We're Getting closer to Fixing  the engine.

It Seems Variables Are not  Being set Properly.

Errors:

Object reference not set to an instance of an object.
No value found.

StringSplit:
Var: %3

Var Should be %~Message

 

 I Haave a FormatException From Reader.ReadNumber().

*PlaceBet1 "~bettingname" - %betamount
 (0:23) When someone emits something with {PlaceBet1} in it,
 (5:110) use variable %~Message and take word 2 and put it into variable %name
        (5:110) use variable %~Message and take word 3 and put it into variable %ammount

 


  '(5:110) use variable % and take word # and put it into variable %
   Function StringSplit(reader As TriggerReaderAs Boolean             Try                 Debug.Print("StringSplit:")                 Dim Var As Variable = reader.ReadVariable(true)                 Debug.Print("Var: " & Var.Name.ToString & " " & Var.Value.ToString)                 Dim i As Double = reader.ReadNumber                 Debug.Print("i: " & i.ToString)                 Dim NewVar As Variable = reader.ReadVariable(true)                 Debug.Print("NewVar " & NewVar.Name.ToString & " " & NewVar.Value.ToString)                 Dim myparser As New TextFieldParser(Var.Value.ToString)                 myparser.TextFieldType = FieldType.Delimited                 myparser.Delimiters = New String() {" "}                 myparser.HasFieldsEnclosedInQuotes = True                 Dim fields() As String = myparser.ReadFields()                 If i < fields.Length - 1 Then                     NewVar.AssignValue(fields(i))                 Else                     NewVar.AssignValue("")                 End If                 Return True             Catch ex As Exception                 Console.WriteLine(ex.Message)                 writer.WriteLine(ex.Message)                 Return False             End Try         End Function
 
Coordinator
May 7, 2012 at 2:58 AM

Has %~ variables worked before?

May 7, 2012 at 3:10 AM

Yes they Have.. I don't think thats the Issue here..

this ones a Compound Problem.. ReadNumber Loosing Data and the creation of New Variables is Corrupting data Some how..

New Variables that are created end up Numeric like %2 or %3

Page.setVariable works Great.

Could Something be wrong with AssignValue?

Coordinator
May 7, 2012 at 3:23 AM

Could you post the stacktrace to the "Object reference not set to an instance of an object.
No value found." message

Coordinator
May 7, 2012 at 3:28 AM
Edited May 7, 2012 at 3:28 AM

 

(5:101) set variable %~var to 1.
(5:102) print {%~var} to the console.

Hooked to a breakpoint I found it trying to create a variable called %1 meaning that the Lexer does not recognize the ~ symbol in the %~var

May 7, 2012 at 3:37 AM

System.FormatException occurred
  Message=Input string was not in a correct format.
  Source=mscorlib
  StackTrace:
       at System.Number.ParseDouble(String value, NumberStyles options, NumberFormatInfo numfmt)
       at System.String.System.IConvertible.ToDouble(IFormatProvider provider)
       at System.Convert.ToDouble(Object value)
       at Monkeyspeak.TriggerReader.ReadNumber() in C:\Users\Gerolkae\Documents\Visual Studio 2010\Projects\monkeyspeak\Monkeyspeak\TriggerReader.cs:line 184
  InnerException:

Monkeyspeak.TriggerReaderException occurred
  Message=No value found.
  Source=Monkeyspeak
  StackTrace:
       at Monkeyspeak.TriggerReader.ReadNumber() in C:\Users\Gerolkae\Documents\Visual Studio 2010\Projects\monkeyspeak\Monkeyspeak\TriggerReader.cs:line 189
  InnerException:

Strange! Works with page.SetVariable.

Maybe I didn't test as Deeply as I should have >.>

Coordinator
May 7, 2012 at 3:39 AM

The InnerException is the most important here :)  could you post that please.

May 7, 2012 at 3:51 AM
Edited May 7, 2012 at 3:52 AM

It's not letting me grab the inner exception

 

Err Innerexception Null

May 7, 2012 at 4:28 AM
Squizzle wrote:

 

(5:101) set variable %~var to 1.
(5:102) print {%~var} to the console.

Hooked to a breakpoint I found it trying to create a variable called %1 meaning that the Lexer does not recognize the ~ symbol in the %~var

Don't like $ either apparently

Coordinator
May 7, 2012 at 4:44 AM
Edited May 7, 2012 at 4:45 AM

Should be fixed.  Download r4.1 please and lemme know.  It won't work with $ besides that should be reserved symbol for currency.

May 7, 2012 at 4:49 AM

with any Special character Work? Maybe Square Brackets?

Coordinator
May 7, 2012 at 5:04 AM

Can't get it to work.  I will probably put in some array handlers in the Sys library.

May 7, 2012 at 5:15 AM

Ah Ok

Your changes Seem to be Working right now

Now If I can Split a String with Quoted Parts in tact I'll be happy!

May 7, 2012 at 7:42 PM

is there a limit to the readers in a MS Line?
I'm loosing a Field Some where. Not sure if its in  Code or if it's reader.ReadString() again. It looks like a field is being skipped over.

*PlaceBet1 "~bettingname" - %betamount
 (0:23) When someone emits something with {PlaceBet1} in it,
 (5:110) use variable %Message and take word 2 and put it into variable %name
        (5:110) use variable %Message and take word 4 and put it into variable %amount
        (5:420) Place entry{%name} at Column {Name} in Table {Fighter1}
        (5:413) update Database info {Bid Ammount} in the table {Fighter1} at row {%name} in column (Name) will now be {%amount}.

Debug.Print >> Error: (5:413) End of values reached.

Monkeyspeak.TriggerReaderException occurred
  Message=End of values reached.
  Source=Monkeyspeak
  StackTrace:
       at Monkeyspeak.TriggerReader.ReadString(Boolean processVariables) in C:\Users\Gerolkae\Documents\Visual Studio 2010\Projects\monkeyspeak\Monkeyspeak\TriggerReader.cs:line 74
  InnerException:

Inner Exception Null >.>

Origional Contents List

Count = 4
0 Bid Ammount //Info
1 Fighter1         // table
2 %name         // Row
3 %amount     // Column ((Should be Name not %name))
4 MIA              // Value Should be ((%amount))

Variables
%Name
%Message
%name
%amount

 '(5:413) update Database info {...} in the table {...} at row {...} in column (...) will now be {...}.
    Public Function UpdateDatabaseInfo(reader As Monkeyspeak.TriggerReaderAs Boolean
        Dim info As String = ""
        Dim Row As String = ""
        Dim Table As String = ""
        Dim column As String = ""
        Dim value As String = ""
        Try
            info = reader.ReadString(True)
            Table = reader.ReadString(True)
            Row = reader.ReadString(True)
            column = reader.ReadString(True)
            value = reader.ReadString(True) << Reader.ReadString Exception Hits here
        Catch ex As Exception
            Dim tID As String = reader.TriggerId
            Dim tCat As String = reader.TriggerCategory
            Console.WriteLine("Error, See Debug Window")
            Dim ErrorString As String = "Error: (" & tCat & ":" & tID & ") " & ex.Message
            writer.WriteLine(ErrorString)
            Debug.Print(ErrorString)
            Return False
        End Try
 
        Dim db = New SQLiteDatabase(file)
        Dim data As New Dictionary(Of [String][String])
        data.Add("[" & column & "]", Row)
        data.Add("[" & info & "]", value)
        Try
            db.Update(Table, data)
            Return True
        Catch crap As Exception
            MessageBox.Show(crap.Message)
            Return False
        End Try
    End Function
May 7, 2012 at 7:55 PM

Any Chance there's confusion with Variable %Name and String "Name"?

Coordinator
May 7, 2012 at 10:27 PM

Your trigger is surrounding (Name) with parenthesis which will be skipped surround it with {..} brackets and it'll work.

May 7, 2012 at 11:29 PM
Edited May 8, 2012 at 12:11 AM

My turn for a stupid moment then.. I totally forgot to check that.

Fixed the Brackets and the Engine Works Nicely!.

All I need to do so far is Fix the Database Lines and Test those suckers out in depth

Coordinator
May 8, 2012 at 2:21 AM

Nice making great progress keep it up.

May 8, 2012 at 11:01 PM

I'm trying! This updates planned to Take Silver Monkey to Beta Version. It'll be nice knowing one dream is using it