Forum VB .Net Select Case statement not permitted?

Select Case statement not permitted?

Postby Cyclone103 » February 11th, 2010, 2:41 am

Code: Select all
Select Case message.Type.ToString
            Case "Moved"
           
        End Select


This amount of code is apparently not permitted. Error thrown:

ServerSideGameCode.SagaMountain.GotMessage(...) uses the non-allowed method: System.Int32 Microsoft.VisualBasic.CompilerServices.Operators::CompareString(System.String,System.String,System.Boolean)

If I comment out the Case line, it all works, but I need that case statement...

I know I can use If/then just as easily, but Select Case makes more sense (For anyone who doesn't know VB, Select Case is the equivalent of "Switch" statements in most languages.)
Cyclone103
 
Posts: 155
Joined: January 18th, 2010, 6:47 pm

Re: Select Case statement not permitted?

Postby Cyclone103 » February 11th, 2010, 3:26 am

Actually, scratch that. Comparisons in general aren't permitted apparently.

Here is my entire overridden sub:
Code: Select all
    Public Overrides Sub GotMessage(ByVal player As SagaMountainPlayer, ByVal message As PlayerIO.GameLibrary.Message)
        MyBase.GotMessage(player, message)
        If message.Type.ToString = "Moved" Then
            'If message.GetString(0).ToString = "Up" Then
            'player.location.Y -= 1
            'End If
            Broadcast("UserMoved", player.location.Y, player.location.X)
        End If
    End Sub


The comments were to try and see what part was causing the error, then I realized any comparison at all throws it. I even tried creating a string with the value Moved, and tried comparing the two, but the same error was thrown.

PLEASE add Microsoft.VisualBasic.CompilerServices.Operators to the whitelist so I can get this working.

Thanks!
Cyclone103
 
Posts: 155
Joined: January 18th, 2010, 6:47 pm

Re: Select Case statement not permitted?

Postby Oliver » February 11th, 2010, 11:23 am

The first time you said you wanted vb support, i thought you were joking...

Now i know you were deadly serious :-)

I'll see about extending ze whitelist.
User avatar
Oliver
.IO
 
Posts: 1159
Joined: January 12th, 2010, 8:29 am

Re: Select Case statement not permitted?

Postby Cyclone103 » February 11th, 2010, 4:14 pm

Haha lol


Yeah, I really do want VB, I just can't stand C#. Thanks for adding that lol!
Cyclone103
 
Posts: 155
Joined: January 18th, 2010, 6:47 pm

Re: Select Case statement not permitted?

Postby Oliver » February 12th, 2010, 11:40 am

The whitelist has been extended with the classes from VB CompilerServices we deemed necessaryfor VB game programming.

The changes will be pushed in the next release. Please let us know if you find more issues.
User avatar
Oliver
.IO
 
Posts: 1159
Joined: January 12th, 2010, 8:29 am

Re: Select Case statement not permitted?

Postby Cyclone103 » February 12th, 2010, 5:36 pm

Cool! When is the next release planned for? I want to get this game going :P
Cyclone103
 
Posts: 155
Joined: January 18th, 2010, 6:47 pm

Re: Select Case statement not permitted?

Postby Oliver » February 12th, 2010, 7:41 pm

Monday
User avatar
Oliver
.IO
 
Posts: 1159
Joined: January 12th, 2010, 8:29 am

Re: Select Case statement not permitted?

Postby Cyclone103 » February 12th, 2010, 11:31 pm

Good, time to go make amazing graphics.

Thanks so much!
Cyclone103
 
Posts: 155
Joined: January 18th, 2010, 6:47 pm

Re: Select Case statement not permitted?

Postby Oliver » February 15th, 2010, 2:22 pm

It's out :)
User avatar
Oliver
.IO
 
Posts: 1159
Joined: January 12th, 2010, 8:29 am

Re: Select Case statement not permitted?

Postby Cyclone103 » February 15th, 2010, 5:14 pm

Awesome, thanks! Time to go test and hopefully not break.
Cyclone103
 
Posts: 155
Joined: January 18th, 2010, 6:47 pm

Re: Select Case statement not permitted?

Postby Cyclone103 » February 15th, 2010, 6:10 pm

Could not load type 'Microsoft.VisualBasic.CompilerServices.Operators' from assembly 'SagaMountainServer, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null'.


It also appears my overridden GotMessage subroutine is never being called:
Code: Select all
Public Overrides Sub GotMessage(ByVal player As SagaMountainPlayer, ByVal message As PlayerIO.GameLibrary.Message)
        MyBase.GotMessage(player, message)
        Select Case message.Type
            Case "Moved"
                Select Case message.GetString(0)
                    Case "Up"
                        player.location.Y -= 1
                End Select
                Console.WriteLine(message.GetString(0))
                Broadcast("UserMoved", player.location.Y, player.location.X)
        End Select
        Console.WriteLine(message.Type)
    End Sub


I never see the message type, no matter what the message contains.


Additionally, try/catch statements aren't allowed as well.
Cyclone103
 
Posts: 155
Joined: January 18th, 2010, 6:47 pm

Re: Select Case statement not permitted?

Postby Oliver » February 16th, 2010, 9:17 am

Zip and send me the project? e-mail is my name at player.io
User avatar
Oliver
.IO
 
Posts: 1159
Joined: January 12th, 2010, 8:29 am

Re: Select Case statement not permitted?

Postby Cyclone103 » February 16th, 2010, 9:50 pm

Sent. Thanks for taking a look Oliver!
Cyclone103
 
Posts: 155
Joined: January 18th, 2010, 6:47 pm

Re: Select Case statement not permitted?

Postby Cyclone103 » February 16th, 2010, 10:16 pm

Oh yeah, and when a player joins my game, THAT PLAYER receives the UserJoined message twice, and that executes twice. I will probably find some way to fix this myself though, should be easy enough.
Cyclone103
 
Posts: 155
Joined: January 18th, 2010, 6:47 pm

Re: Select Case statement not permitted?

Postby Toby » February 16th, 2010, 10:32 pm

I found the solution.


...Use c#
User avatar
Toby
 
Posts: 86
Joined: January 14th, 2010, 4:01 pm

Re: Select Case statement not permitted?

Postby Cyclone103 » February 16th, 2010, 10:43 pm

Nothx
Cyclone103
 
Posts: 155
Joined: January 18th, 2010, 6:47 pm

Re: Select Case statement not permitted?

Postby Cyclone103 » February 18th, 2010, 2:16 am

Ah lovely,

Code: Select all
SocketConnection.ReceivedBytes ERROR: Object '/eef03342_b28f_46de_9b28_495a8ffbdab7/p4xhirlqzkivdoi_ylheqjsg_17.rem' has been disconnected or does not exist at the server., Appdomain: Test Server Project.vshost.exe


I get this every few connects, it refuses to send the hello message. This is in the actual dev server console.
Cyclone103
 
Posts: 155
Joined: January 18th, 2010, 6:47 pm

Re: Select Case statement not permitted?

Postby Oliver » February 18th, 2010, 11:25 am

We've found and fixed the main issue; it will be in the next release, but i'm also e-mailing you a special dev server that will work right now.

Oh yeah, and when a player joins my game, THAT PLAYER receives the UserJoined message twice, and that executes twice. I will probably find some way to fix this myself though, should be easy enough.


We couldn't replicate that, but we only tried to replicate it after having fixed the first issue -- so our thinking is that it was caused by the first issue.

SocketConnection.ReceivedBytes ERROR: Object '/eef03342_b28f_46de_9b28_495a8ffbdab7/p4xhirlqzkivdoi_ylheqjsg_17.rem' has been disconnected or does not exist at the server., Appdomain: Test Server Project.vshost.exe


Know issue: we're looking into it.

- Oliver
User avatar
Oliver
.IO
 
Posts: 1159
Joined: January 12th, 2010, 8:29 am

Re: Select Case statement not permitted?

Postby Cyclone103 » February 18th, 2010, 9:23 pm

Thanks Oliver! Works like a charm, thanks for identifying the issue.

I figured the second thing out, it was a small problem with my coding (I fixed it)

Okay, that last one isn't really too much of a problem.
Cyclone103
 
Posts: 155
Joined: January 18th, 2010, 6:47 pm


Return to VB .Net