Jump to content
Search In
  • More options...
Find results that contain...
Find results in...

[EO] Client to Server Communication


Warconn
 Share

Recommended Posts

Alright, so i have started using EO and am messing around with the Packets and Buffers. I followed a tutorial that help me understand how everything is working.

I tryed setting up a simple client/Server communication, but i am having some problems. Sorry if this is a very simple problem, but i am just trying to get a handle on the new network system.

Here is my code Client Side:
```
Public Sub PlayerDev(ByVal Stat As String, ByVal Value As Integer)
    Debug.Print Stat & " will be adjusted " & Value & " points"
    'case for the stat
    Select Case Stat
        Case "str"
        'adjust the strength value
            'set up the buffer to send the strength skill update
            Dim buffer As clsBuffer

            Set buffer = New clsBuffer
            Debug.Print "StrBuffer set up"

            buffer.WriteLong CStrSkill
            buffer.WriteInteger Value
            Debug.Print "StrBuffer values set"
            Debug.Print buffer.ToArray

            SendData buffer.ToArray()
            Set buffer = Nothing
            Debug.Print "StrBuffer sent and cleared"
            Exit Sub

    End Select

End Sub

```
That sends the value to the selected stat. I got that part down, but here is where i get messed up and dont really understand.

ServerSide:
```
    HandleDataSub(CStrSkill) = GetAddress(AddressOf HandleStrSkill)

```
And

```
Sub HandleStrSkill(ByVal Index As Long, ByRef Data() As Byte, ByVal StartAddr As Long, ByVal ExtraVar As Long)
    Dim Value As Integer

    ' make sure they're not maxed#
    If GetPlayerStat(Index, Stats.Strength) >= 255 Then
        PlayerMsg Index, "You cannot spend any more points on that stat.", BrightRed
        Exit Sub
    End If
    Debug.Print "Str Stat Not Maxed"

    Call SetPlayerStat(Index, Stats.Strength, GetPlayerStat(Index, Stats.Strength) + Value)
    Debug.Print "Str Stat Adjusted " & Value

    SendActionMsg GetPlayerMap(Index), "+" & Value & " Strength", White, 1, (GetPlayerX(Index) * 32), (GetPlayerY(Index) * 32)

    ' Send the update
    'Call SendStats(Index)
    SendPlayerData Index
    Debug.Print "PlayerData Updated"

End Sub

```
Now i added the vars cstrskill to both projects, but when i run this, i get the value serverside = 0… i just dont know what is going wrong.

Thanks
Warconn
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...