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

Recommended Posts

Posted
Where can I find the code that handles what happens when a player presses enter on an attribute.

Do I need to make a new sub routine for it or does one already exist?

I'm making an attribute that changes the players sprite when you press enter on the attribute.

Thanks.  ;)
Posted
I've copied the code in the client that checks for an item when you press enter. This should work exactly the same for checking if the player is standing on a Mount attribute tile:
```
Sub CheckMapMount()
Dim Buffer As New clsBuffer

    ' If debug mode, handle error then exit out
    If Options.Debug = 1 Then On Error GoTo errorhandler

    Set Buffer = New clsBuffer

    If GetTickCount > Player(MyIndex).MapGetTimer + 250 Then
        If Trim$(MyText) = vbNullString Then
            Player(MyIndex).MapGetTimer = GetTickCount
            Buffer.WriteLong CMapMount
            SendData Buffer.ToArray()
        End If
    End If

    Set Buffer = Nothing

    ' Error handler
    Exit Sub
errorhandler:
    HandleError "CheckMapMount", "modGameLogic", Err.Number, Err.Description, Err.Source, Err.HelpContext
    Err.Clear
    Exit Sub
End Sub
```
But it's not sending anything to the server like it should be.
Posted
~~I can't really get a clear focus on what your trying to do. Is it alright if you can show some screen shots along with some more details?~~

Edit : okay after reading it 5 times in a row, i figured your trying to add a spite changer on event on the map editor. There should be on that already exist on the engine but work differently of course, relating to the way you can pick up items. I'd write a new sub for it that might as well work with the door attribute.
Posted
I'll give my code…. Might make things easier to understand.

In **Sub CheckInputKeys** I have this:
```
If GetKeyState(vbKeyReturn) < 0 Then
        CheckMapGetItem
        CheckMapMount
    End If
```
Then this:
```
Sub CheckMapMount()
Dim Buffer As New clsBuffer

    ' If debug mode, handle error then exit out
    If Options.Debug = 1 Then On Error GoTo errorhandler

    Set Buffer = New clsBuffer

    If GetTickCount > Player(MyIndex).MapGetTimer + 250 Then
        If Trim$(MyText) = vbNullString Then
            Player(MyIndex).MapGetTimer = GetTickCount
            Buffer.WriteLong CMapMount
            SendData Buffer.ToArray()
        End If
    End If

    Set Buffer = Nothing

    ' Error handler
    Exit Sub
errorhandler:
    HandleError "CheckMapMount", "modGameLogic", Err.Number, Err.Description, Err.Source, Err.HelpContext
    Err.Clear
    Exit Sub
End Sub
```
That's all for the client, I then gone to the server….

I've added **CMapMount** as a variable and also added the following:
```
HandleDataSub(CMapMount) = GetAddress(AddressOf HandleMapMount)
```
```
Sub HandleMapMount(ByVal index As Long, ByRef Data() As Byte, ByVal StartAddr As Long, ByVal ExtraVar As Long)
    Call PlayerMapMount(index)
End Sub
```
Then the sub which handles what should happen when a player Mounts:
```
Sub PlayerMapMount(ByVal index As Long)
    Dim i As Long
    Dim n As Long
    Dim mapNum As Long
    Dim Msg As String

    If Not IsPlaying(index) Then Exit Sub
    mapNum = GetPlayerMap(index)

    ' Check that the player is on a Mount attribute tile
    If Map(GetPlayerMap(index)).Tile(GetPlayerX(index), GetPlayerY(index)).Type <> TILE_TYPE_MOUNT Then
        Exit Sub
    Else
        PlayerMsg index, "Suck my balls", vbWhite
    End If

End Sub
```
Obviously haven't added the full code to change sprite since I'm trying to get the first part working.

When I debug, it seems as though it's not even sending any data to the server from **Sub CheckMapMount**.

What am I doing wrong in that sub routine?
Posted
@Yukiyo:

> Wheres your```
> Buffer.WriteBytes Data()
> ```?

Well there some things that are missing. I'm just filling the holes for him.
Posted
@Lavos:

> Well there some things that are missing. I'm just filling the holes for him.

What I'm saying is he didn't include it in HIS code.
Which is all kinds of jacked up. Let me download VB6 and I'll try to help.
Posted
Your Sub CheckMapMount isn't sending any data, only an empty packet. And your HandleMapMount isn't attempting to read any data and process it, all it does is call a sub with no parameters. Why don't you use break points to test if the server is recieving/handling the packet? To use a break point, click on the blank left side of your code and a red circle will appear next to the line, when the program uses that line it'll tell you, and then you know that it's being processed and we can further investigate the issue.

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
×
×
  • Create New...