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

EO - WASD Movement


Rob Janes
 Share

Recommended Posts

  • Replies 68
  • Created
  • Last Reply

Top Posters In This Topic

@UzGo:

> Am I doing it right ?
>
> |
> |
> V

Change the sub to this:```
Public Sub SetFocusOnChat()
On Error Resume Next

'prevent RTE5, no way to handle error
If ChatFocus = False Then
ChatFocus = True
frmMain.txtMyChat.SetFocus
ElseIf ChatFocus = True Then
ChatFocus = False
frmMain.picScreen.SetFocus
End If
End Sub
```
Link to comment
Share on other sites

@Erwin:

> Change the sub to this:```
> Public Sub SetFocusOnChat()
> On Error Resume Next
>
> 'prevent RTE5, no way to handle error
> If ChatFocus = False Then
> ChatFocus = True
> frmMain.txtMyChat.SetFocus
> ElseIf ChatFocus = True Then
> ChatFocus = False
> frmMain.picScreen.SetFocus
> End If
> End Sub
> ```

The same problem again but thanks anyway for your reply
Link to comment
Share on other sites

Hello, I'm having a couple rather specific problems with this code as well. I'll go ahead and list them out here.

1\. Before you do anything, if you click on the game screen it focuses on chat so that you can talk. From this point you cannot refocus on the game from chat until you click to focus on chat or say something. This of course is not something I want to happen. Focus changing to the chat box is kind of buggy in general as well, there is more than one thing that will cause the client to switch to letting you type.

2\. Upon clicking a chat box in the Admin panel, after closing the Admin Panel it focuses on chat so you can talk. I'd rather it didn't.

3\. I have it set up so that the Return key is my chat focus key, however I have to click on the game screen to bring focus back to my game from chat, I want to be able to hit Return a second time to do this. In fact, sometimes clicking on the game screen doesn't work at all, you have to actually hit the Return key several times in rapid succession (Only way it will work, don't know why) and then click the game screen after doing so, which will return focus to the game.

I have followed the instructions to a T as far as I know. If needed I can post copies of specific code you may want to look over for me, or whatever. I'm new to Visual Basic 6 by the way, currently learning VB.NET in college. I would much rather use .NET for the game, as I know a plethora more about it. However I'm not nearly that experienced yet. ^_^

Sorry if I rambled on a bit too much, and any help will be greatly appreciated. Also appreciation is about all I have to give, being completely new to the community.  ;)
Link to comment
Share on other sites

  • 1 month later...
  • 2 months later...
@Boko:

> Well I play WoW so I'm use to it :P
>
> For those interested in the return key toggle chat method, here's the code:
> (Full Client Side, it's not too different to the OP's method)
> **(Updated with fix from 2nd page)**
> **In modGlobals:**
> _Add:_
> ```
> ' Chat Focus
> Public ChatFocus As Boolean
> Public KeyDown As Boolean
> ```
> **In modGeneral:**
> _Replace entire_ **Public Sub SetFocusOnChat** _with:_
> ```
> Public Sub SetFocusOnChat()
>     On Error Resume Next 'prevent RTE5, no way to handle error
>     If ChatFocus = False Then
>         ChatFocus = True
>         frmMain.txtMyChat.SetFocus
>     ElseIf ChatFocus = True Then
>         ChatFocus = False
>         frmMain.picScreen.SetFocus
>     End If
> End Sub
> ```
> **In modGeneral:**
> _In_ **Sub GameInit**_, just before_ **Call SetFocusOnChat**_, Add:_
> ```
> ChatFocus = True ' Default to screen focus
> ```_Also, move the following above the_ **Call SetFocusChat** _instead of below it (because it's not possible to set focus on picScreen if it's not visible yet)_
> ```
> frmMain.picScreen.Visible = True
> ```
> **In modInput:**
> _Replace:_
> ```
> If GetKeyState(vbKeyReturn) < 0 Then
>         CheckMapGetItem
> End If
> ```_With: (Replace_ **NEWKEY** _with which ever key you'd prefer to have for picking up items)_
> _(If you're going the route of WASD movement, a key like Q wouldn't be a bad choice, replace with_ **vbKeyQ** _for example)_
> ```
> If GetKeyState(vbKeyNEWKEY) < 0 Then
>         CheckMapGetItem
> End If
> ```
> _Just under or above that add:_
> ```
> If GetKeyState(vbKeyReturn) < 0 And KeyDown = False Then
>         KeyDown = True
>     ElseIf Not GetKeyState(vbKeyReturn) < 0 And KeyDown = True Then
>         KeyDown = False
>         Call SetFocusOnChat
>     End If
> ```
> You may now also add OP's WASD movement config to this **modInput** _file._
> _But I recommend just adding Or statements to the arrow key ones instead of making new individual statements, for example:_
> _Replace:_
> ```
> If GetKeyState(vbKeyUp) < 0 Then
> ```_With:_
> ```
> If GetKeyState(vbKeyUp) < 0 Or GetKeyState(vbKeyW) < 0 Then
> ```
> _You will still need the_ **ChatFocus** _if statement around them to ensure you're not moving when typing w/a/s/d.
> You may also prefer to wrap it around all the key presses to ensure when you're typing, you're only typing. (If you were to attempt to paste something in to the chat for example and you're standing next to someone, you're going to end up accidentally hitting them by the control key press.)_
>
> **Optional Step:**
>
> **In frmMain (Code):**
> _In_ **Private Sub picScreen_MouseDown** _Remove/Comment:_
> ```
> Call SetFocusOnChat
> ```_(This causes the return key to be the only method of switching focus, but it's not required.. personally preference)_
>
> I might be forgetting something, I patched this up in just a couple minutes by looking at OP's code.

I tried using this, and when chat was focused I could still move. This is a better way of doing the keys I personally think, when chat isnt focused you can use up, down, left, right, w, a, s & d to move. When it IS focused you cant move.

This is my method (Also first code ive ever changed personally OMG :DDDD lmfao:

DISABLE MOVEMENT WHILE CHAT IS FOCUSED
```
'Move Right
    If ChatFocus = False Then
    If GetKeyState(vbKeyRight) < 0 Or GetKeyState(vbKeyD) < 0 Then

        DirUp = False
        DirDown = False
        DirLeft = False
        DirRight = True
        Exit Sub
    Else
        DirRight = False
    End If
    End If
    If ChatFocus = True Then
    If GetKeyState(vbKeyD) < 0 Then

        DirUp = False
        DirDown = False
        DirLeft = False
        DirRight = False
    End If
    End If
```
Then rinse and repeat :D

EDIT:
To stop focusing on the chat box whenever you equip/use something:
Find:
```
If x > picInventory.width - 10 Then
```Then null out the line above it with a ' like so..
```
'SetFocusOnChat
    If x > picInventory.width - 10 Then
```
Link to comment
Share on other sites

  • 1 month later...
  • 2 months later...
@Rob:

> Sounds like you are clicking on the RichTextBox (txtChat) where messages are written, try clicking on the txtMyChat box, the smaller one where you would write messages.  Make sure you added the flag to the txtMyChat.
>
> An easy fix to your issue would be on the txtChat Click event, add
> ```
> ChatFocus=True
> txtMyChat.setFocus
> ```

i have same problem can you be more specific to what to remove,replace,add to fix this problem
Link to comment
Share on other sites

  • 1 month later...
I'm having problems.
1\. I am able to chat in the chat box and erase everything in there. (but i can write in the small box).
2\. I am not able to move with WASD

Extra info: I am using EO 2.0
                I am able to unfocus on my chatbox
Link to comment
Share on other sites

  • 2 months later...
  • 5 weeks later...
  • 2 weeks later...
Followed the OP's directions, stopped after completing OP's, it didn't work for me I still flood the chat and the sprite doesn't move. Working with EO 2.3, went through multiple times to make sure I didn't forget or put it in the wrong spot. But as far as I can tell everything is right! Any help.
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...