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

HandleDataSub doesn´t call the function


iLeGiTiMx
 Share

Recommended Posts

Hey.

I have a HandleDataSub from Rob

```
HandleDataSub(SSendAuctions) = GetAddress(AddressOf HandleSendAuctions)
```

```
Private Sub HandleSendAuctions(ByVal Index As Long, ByRef data() As Byte, ByVal StartAddr As Long, ByVal ExtraVar As Long)
Dim buffer As clsBuffer
Dim i As Long

'Clear the List of Auctions on the Main Page
frmMain.listAuctions.Clear
Set buffer = New clsBuffer
buffer.WriteBytes data()
For i = 1 To MAX_AUCTIONS
Auction(i).ItemNum = buffer.ReadLong
Auction(i).Amount = buffer.ReadLong
Auction(i).Owner = buffer.ReadString
Auction(i).Current_Bid = buffer.ReadLong
Auction(i).Current_Bid_Owner = buffer.ReadString
Auction(i).Buyout_Bid = buffer.ReadLong
Auction(i).Currency_ItemNum = buffer.ReadLong
Auction(i).MinuteCounter = buffer.ReadLong
Auction(i).Status = buffer.ReadByte
Auction(i).Claimed = buffer.ReadByte
'Add running items to the list
If Auction(i).Status = Auction_Running Then
If Auction(i).ItemNum > 0 Then
frmMain.listAuctions.AddItem Trim(Item(Auction(i).ItemNum).Name) & " [Current Bid: " & Auction(i).Current_Bid & " " & Trim(Item(Auction(i).Currency_ItemNum).Name) & "] - [Buyout: " & Auction(i).Buyout_Bid & "] " & Trim(Item(Auction(i).Currency_ItemNum).Name)
Else
frmMain.listAuctions.AddItem "Available Auction Slot"
End If
End If
'Add successful items to the list
If Auction(i).Status = Auction_Successful Then
If Auction(i).ItemNum > 0 Then
frmMain.listAuctions.AddItem "Ended Successfully - " & Trim(Item(Auction(i).ItemNum).Name) & " [Current Bid: " & Auction(i).Current_Bid & " " & Trim(Item(Auction(i).Currency_ItemNum).Name) & "]"
Else
frmMain.listAuctions.AddItem "Available Auction Slot"
End If
End If
'Add expired items to the list
If Auction(i).Status = Auction_Expired Then
If Auction(i).ItemNum > 0 Then
frmMain.listAuctions.AddItem "Expired - " & Trim(Item(Auction(i).ItemNum).Name) & " [Current Bid: " & Auction(i).Current_Bid & " " & Trim(Item(Auction(i).Currency_ItemNum).Name) & "]"
Else
frmMain.listAuctions.AddItem "Available Auction Slot"
End If
End If
Next i
End Sub
```
The HandleDataSub is called at login, I tested it with a Breakpoint.
But the Function HandleSendAuctions not. In another vb project it works like this.
When i rename the HandleSendAuctions to something existing, it works.

In modEnumerations i have "SSendAuctions" so this is not the problem.
I don´t know where the mistake is. It´s exactly like another project.
Thank you :)

Best regards, TGSLp
Link to comment
Share on other sites

Do you have SSendAuctions in the server? This will only trigger if it receives that command from the server.

The code looks fine, I'm thinking the problem lies in another part of the code you have not shown.
Link to comment
Share on other sites

SSendAuctions needed in server and client both

also need CRequestAuctions (A packet from client to server requesting this list) and they need to interact. Have you done anything like this before to understand communications?
Link to comment
Share on other sites

@'Diefool':

> **also need CRequestAuctions (A packet from client to server requesting this list)** and they need to interact. Have you done anything like this before to understand communications?

A packet for that isn't ~~needed~~ necessary. [EDIT: [url=http://www.freemmorpgmaker.com/thread-85838-post-946434.html#pid946434]What I actually meant]
To the OP: Do you send a packet with header 'SSendAuctions' from the server to the client?

> When i rename the func "HandleSendAuctions" to another existing, it´s gonna called..

Do you mean you change the name of the function or the 'GetAddress(AddressOf) part? 
```
HandleDataSub(SSendAuctions) = GetAddress(AddressOf HandleSendAuctions)
```^ That should be InitMessages and should be called when the game first initializes and not at login. Make sure the value of 'HandleDataSub(SSendAuctions)' when it is first assigned and sometime later is the same. 

P.S I apologize if the font of this post comes out weird.. This post reply editor isn't behaving properly.
Link to comment
Share on other sites

Why isn't it necessary for the client to request this information? If the server doesn't send it upon request of the client, how will the server know when to send the auction list? Sorry, I'm not trying to argue your point, just understand.
Link to comment
Share on other sites

When I said "**A packet for that isn't needed.**", what I actually meant was that it isn't always necessary to request data to be sent. Consider the list of items of the game. This is sent when the client is authenticated and logs in. It really isn't 'requested'. It just gets sent, once. The list is updated and sent to the clients only when an admin modifies any item.

In the context of an auction list, it's easier and better to actually have request packets.
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...