I have a question. I am currently changing all the variables that store from the DB to just loading straight from the DB. This is a microsoft access DB, EX:
Grabs from DB, places into a variables, user /saves, stores back into a variable.
TO
Grabs striaght from DB for any loading, when player changes something, aka lets say he gains 10 HP, it will save it straight to the DB.
You can sorta find my old post of what I was doing here: http://www.vbforums.com/showthread.p...09#post2401209
It' has been going okay for now, but I have a question, for example, a character chats, it must be outputted to the players in the chat room. As of now, the DB stores all the information, like what room he was on. It was easy using the variables, here:Basicly, it would scan for anyone who was in the room, INDEX being the player who talks, (i) being the search, so any identical matches, it would output, if they were online of course.VB Code:
'Chat Sub Private Sub PublicChat(ByVal Index As Integer, Comarray() As String, ComI As Integer) Dim i As Integer 'Send to all users in room For i = WStcpServer.LBound + 1 To WStcpServer.UBound If userroom(i) = userroom(Index) Then 'In the room? MsgSend = "~yFrom " & "~w" & users(Index) & "~y: " & Comarray(ComI) blnRetVal = WinsockSend(WStcpServer(i), MsgSend) Else End If Next EEnd Sub
Now, how would this be changed to straight load into the DB? I know of FINDFIRST and such.... The only variable is stored is the username index number for quick calling, since they cannot change it anyways..Basicly, it would have to find all the users with the same room in the DB then output them in the socket, how would this be changed? Any info or help would be grateful!VB Code:
Private Sub PublicChat(ByVal Index As Integer, Comarray() As String, ComI As Integer) Dim i As Integer If Not rsroomdata.EOF Then rsroomdata.MoveFirst ' make sure your on the first one rsuserdata.FindFirst "CharacterName='" & username(Index) & "'" 'Find the username ***This will grab the username that is calling it up, so it can get the userroom. userroom = rsuserdata!Room 'User room, I believe. 'Send to all users in room For i = WStcpServer.LBound + 1 To WStcpServer.UBound [B] If ??? = userroom Then 'How would I search, IN THE ROOM?[/B] MsgSend = "~yFrom " & "~w" & rsuserdata!CharacterName & "~y: " & Comarray(ComI) blnRetVal = WinsockSend(WStcpServer(i), MsgSend) Else End If Next End Sub
