Mirage Source

Free ORPG making software.
It is currently Sat Apr 27, 2024 11:35 am

All times are UTC


Forum rules


Make sure your tutorials are kept up to date with the latest MS4 releases.



Post new topic Reply to topic  [ 1615 posts ]  Go to page 1, 2, 3, 4, 5 ... 65  Next
Author Message
PostPosted: Mon Sep 22, 2008 5:15 am 
Offline
Knowledgeable
User avatar

Joined: Sun Nov 19, 2006 6:59 pm
Posts: 213
Alright, so this is a pretty simple feature. It's basically like a Caps Lock, except instead of Caps, you run :P

Difficulty : 1 / 5

ModGlobals

In modGlobals, look for

Code:
' Game direction vars


And in that little section, add :
Code:
Public IsUserTabbed As Boolean
.

In modConstants, look for :
Code:
Public Const VK_CONTROL As Long = &H11


And under it add :
Code:
Public Const VK_TAB as long = &H9


Now, in modGameLogic, look for sub GameLoop. Add the following variable at the top, inside that sub :

Code:
Dim TabTimer as long


and then look for the following snippet :

Code:
        If GetAsyncKeyState(VK_CONTROL) >= 0 Then
            If ControlDown = True Then
            ControlDown = False
            End If
        End If


and add this under :

Code:
        If GetAsyncKeyState(VK_TAB) <> 0 Then
            If TabTimer + 1000 < GetTickCount Then
                IsUserTabbed = Not IsUserTabbed
                TabTimer = GetTickCount
            End If
        End If


Now, what this code does is, each time you press tab, it will turn the IsUserTabbed boolean on and off, so you just have to press it once and it'll turn on :). The reason for the TabTimer is because, with that function, it is processed very quickly, and if you hold tab it will mess up. You cannot do this with the CheckInput sub because the Tab key code is basically 'removed' by VB6 since you use tab to go through controls.

Now, in modGameLogic, look for sub CheckMovement. Now, look at the part that says :

Code:
            ' Check if player has the shift key down for running
            If ShiftDown Then
                Player(MyIndex).Moving = MOVING_RUNNING
            Else
                Player(MyIndex).Moving = MOVING_WALKING
            End If


And replace it with :

Code:
            ' Check if player has the shift key down for running
            If ShiftDown Or IsUserTabbed Then
                Player(MyIndex).Moving = MOVING_RUNNING
            Else
                Player(MyIndex).Moving = MOVING_WALKING
            End If


This will check whether you are pressing shift or you pressed tab to turn on the Auto-Run :) And there you go, wasn't that simple? :D

_________________
Image


Last edited by JokeofWeek on Mon Sep 22, 2008 6:08 am, edited 1 time in total.

Top
 Profile  
 
PostPosted: Mon Sep 22, 2008 5:50 am 
Offline
Persistant Poster
User avatar

Joined: Thu Jul 24, 2008 6:42 am
Posts: 703
Google Talk: infectiousbyte@gmail.com
Didn't work for me. I press tab, but it doesn't do anything. Maybe I did the tut wrong.

_________________
Image
GIAKEN wrote:
Since I'm into men, not women

GIAKEN wrote:
I can't take these huge penises anymore! All that's left is shame! And blood


Top
 Profile  
 
PostPosted: Mon Sep 22, 2008 6:09 am 
Offline
Knowledgeable
User avatar

Joined: Sun Nov 19, 2006 6:59 pm
Posts: 213
Sorry about that, updated it now :D

_________________
Image


Top
 Profile  
 
PostPosted: Mon Sep 22, 2008 6:27 am 
Offline
Persistant Poster
User avatar

Joined: Thu Jul 24, 2008 6:42 am
Posts: 703
Google Talk: infectiousbyte@gmail.com
Works now. Awesome job dude.

_________________
Image
GIAKEN wrote:
Since I'm into men, not women

GIAKEN wrote:
I can't take these huge penises anymore! All that's left is shame! And blood


Top
 Profile  
 
PostPosted: Mon Sep 22, 2008 9:40 am 
Offline
Regular

Joined: Sat Sep 13, 2008 1:41 am
Posts: 97
I added this feature into my client good job.


Top
 Profile  
 
PostPosted: Mon Sep 22, 2008 2:10 pm 
Offline
Knowledgeable
User avatar

Joined: Wed Jul 26, 2006 11:22 pm
Posts: 143
Location: Virginia, USA
Dude nice. :D This will save people like me who suffer from carpal tunnel. Lets us not hold a key down all day when it already hurts to type a lot.


Top
 Profile  
 
PostPosted: Mon Sep 22, 2008 7:44 pm 
Offline
Knowledgeable
User avatar

Joined: Fri Sep 12, 2008 11:18 pm
Posts: 176
Location: England.
Kind of an off/on-topic note:

Code:
Public Const VK_CONTROL As Long = &H11


how do you get the &H11? Just make it up?


Top
 Profile  
 
PostPosted: Mon Sep 22, 2008 8:28 pm 
Offline
Pro
User avatar

Joined: Tue Nov 13, 2007 2:42 pm
Posts: 509
I found this snippet of code awhile ago:

Code:
' Used so we can actually use the tab key ingame
    For i = 0 To Controls.Count - 1
       Controls(i).TabStop = False
       ' Has to be used for controls that don't have tabstop
       On Error Resume Next
    Next


This will allow you use tabkey without any problems. It would get added Form_Load().


Top
 Profile  
 
PostPosted: Mon Sep 22, 2008 9:24 pm 
Offline
Knowledgeable
User avatar

Joined: Sun Nov 19, 2006 6:59 pm
Posts: 213
Mattyw wrote:
Kind of an off/on-topic note:

Code:
Public Const VK_CONTROL As Long = &H11


how do you get the &H11? Just make it up?


Nah, &H11 is the hexadecimal value for that Key ;)

Dugor wrote:
I found this snippet of code awhile ago:

Code:
' Used so we can actually use the tab key ingame
    For i = 0 To Controls.Count - 1
       Controls(i).TabStop = False
       ' Has to be used for controls that don't have tabstop
       On Error Resume Next
    Next


This will allow you use tabkey without any problems. It would get added Form_Load().


Ah nice, I modify it to use that :) Thanks mate =]

_________________
Image


Top
 Profile  
 
PostPosted: Mon Sep 22, 2008 9:38 pm 
Offline
Knowledgeable
User avatar

Joined: Fri Sep 12, 2008 11:18 pm
Posts: 176
Location: England.
JokeofWeek wrote:
Mattyw wrote:
Kind of an off/on-topic note:

Code:
Public Const VK_CONTROL As Long = &H11


how do you get the &H11? Just make it up?


Nah, &H11 is the hexadecimal value for that Key ;)

Dugor wrote:
I found this snippet of code awhile ago:

Code:
' Used so we can actually use the tab key ingame
    For i = 0 To Controls.Count - 1
       Controls(i).TabStop = False
       ' Has to be used for controls that don't have tabstop
       On Error Resume Next
    Next


This will allow you use tabkey without any problems. It would get added Form_Load().


Ah nice, I modify it to use that :) Thanks mate =]


So how do I find the Hex value of keys. :S


Top
 Profile  
 
PostPosted: Mon Sep 22, 2008 9:41 pm 
Offline
Persistant Poster
User avatar

Joined: Thu Mar 29, 2007 10:30 pm
Posts: 1510
Location: Virginia, USA
Google Talk: hpmccloud@gmail.com
Google them.

_________________
Nean wrote:
Yes harold. Give it to me.

Image
Image


Top
 Profile  
 
PostPosted: Wed Dec 01, 2021 7:49 am 
Online
Mirage Source Lover

Joined: Sun Jul 04, 2021 4:04 am
Posts: 489228
инфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфо
инфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфо
инфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфо
инфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинйоинфоинфоинфоинфоинфо
инфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфо
инфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфо
инфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфо
инфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфо
инфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоsemiasphalticflux.ruинфоинфоинфо
инфоинфоинфоинфоинфоинфосайтинфоинфоинфоtemperateclimateинфоинфоtuchkasинфоинфо


Top
 Profile  
 
PostPosted: Tue Dec 28, 2021 11:49 am 
Online
Mirage Source Lover

Joined: Sun Jul 04, 2021 4:04 am
Posts: 489228
Econ


Top
 Profile  
 
PostPosted: Tue Dec 28, 2021 11:50 am 
Online
Mirage Source Lover

Joined: Sun Jul 04, 2021 4:04 am
Posts: 489228
50.6


Top
 Profile  
 
PostPosted: Tue Dec 28, 2021 11:51 am 
Online
Mirage Source Lover

Joined: Sun Jul 04, 2021 4:04 am
Posts: 489228
Bett


Top
 Profile  
 
PostPosted: Tue Dec 28, 2021 11:52 am 
Online
Mirage Source Lover

Joined: Sun Jul 04, 2021 4:04 am
Posts: 489228
Bett


Top
 Profile  
 
PostPosted: Tue Dec 28, 2021 11:53 am 
Online
Mirage Source Lover

Joined: Sun Jul 04, 2021 4:04 am
Posts: 489228
Unit


Top
 Profile  
 
PostPosted: Tue Dec 28, 2021 11:55 am 
Online
Mirage Source Lover

Joined: Sun Jul 04, 2021 4:04 am
Posts: 489228
Girl


Top
 Profile  
 
PostPosted: Tue Dec 28, 2021 11:56 am 
Online
Mirage Source Lover

Joined: Sun Jul 04, 2021 4:04 am
Posts: 489228
Toto


Top
 Profile  
 
PostPosted: Tue Dec 28, 2021 11:57 am 
Online
Mirage Source Lover

Joined: Sun Jul 04, 2021 4:04 am
Posts: 489228
Stan


Top
 Profile  
 
PostPosted: Tue Dec 28, 2021 11:58 am 
Online
Mirage Source Lover

Joined: Sun Jul 04, 2021 4:04 am
Posts: 489228
Mary


Top
 Profile  
 
PostPosted: Tue Dec 28, 2021 11:59 am 
Online
Mirage Source Lover

Joined: Sun Jul 04, 2021 4:04 am
Posts: 489228
Pack


Top
 Profile  
 
PostPosted: Tue Dec 28, 2021 12:00 pm 
Online
Mirage Source Lover

Joined: Sun Jul 04, 2021 4:04 am
Posts: 489228
Sara


Top
 Profile  
 
PostPosted: Tue Dec 28, 2021 12:01 pm 
Online
Mirage Source Lover

Joined: Sun Jul 04, 2021 4:04 am
Posts: 489228
Oper


Top
 Profile  
 
PostPosted: Tue Dec 28, 2021 12:02 pm 
Online
Mirage Source Lover

Joined: Sun Jul 04, 2021 4:04 am
Posts: 489228
Orie


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 1615 posts ]  Go to page 1, 2, 3, 4, 5 ... 65  Next

All times are UTC


Who is online

Users browsing this forum: No registered users and 37 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB® Forum Software © phpBB Group