Warconn Posted January 6, 2011 Author Share Posted January 6, 2011 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 SelectEnd 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.ThanksWarconn Link to comment Share on other sites More sharing options...
westin444 Posted January 6, 2011 Share Posted January 6, 2011 You never set value. Look at the other packets server side. Link to comment Share on other sites More sharing options...
Tdogthedog Posted January 6, 2011 Share Posted January 6, 2011 thats because your variable "Value" isn't assigned anything.. add these lines under the Dim Value Dim Buffer As clsBuffer Set Buffer = New clsBuffer Buffer.WriteBytes Data() Value = Buffer.ReadInteger Link to comment Share on other sites More sharing options...
Warconn Posted January 6, 2011 Author Share Posted January 6, 2011 AHhh haha, thanks i knew it would be something small like that…. Thanks again Link to comment Share on other sites More sharing options...
westin444 Posted January 6, 2011 Share Posted January 6, 2011 No problem. Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now