Mirage Source http://www.miragesource.net/forums/ |
|
[FEATURE] Lock Movement on Tab http://www.miragesource.net/forums/viewtopic.php?f=183&t=4419 |
Page 1 of 65 |
Author: | JokeofWeek [ Mon Sep 22, 2008 5:15 am ] |
Post subject: | [FEATURE] Lock Movement on Tab |
Alright, so this is a pretty simple feature. It's basically like a Caps Lock, except instead of Caps, you run 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? |
Author: | Nean [ Mon Sep 22, 2008 5:50 am ] |
Post subject: | Re: [FEATURE] Lock Movement on Tab |
Didn't work for me. I press tab, but it doesn't do anything. Maybe I did the tut wrong. |
Author: | JokeofWeek [ Mon Sep 22, 2008 6:09 am ] |
Post subject: | Re: [FEATURE] Lock Movement on Tab |
Sorry about that, updated it now |
Author: | Nean [ Mon Sep 22, 2008 6:27 am ] |
Post subject: | Re: [FEATURE] Lock Movement on Tab |
Works now. Awesome job dude. |
Author: | skillzalot [ Mon Sep 22, 2008 9:40 am ] |
Post subject: | Re: [FEATURE] Lock Movement on Tab |
I added this feature into my client good job. |
Author: | Kousaten [ Mon Sep 22, 2008 2:10 pm ] |
Post subject: | Re: [FEATURE] Lock Movement on Tab |
Dude nice. 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. |
Author: | Mattyw [ Mon Sep 22, 2008 7:44 pm ] |
Post subject: | Re: [FEATURE] Lock Movement on Tab |
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? |
Author: | Jacob [ Mon Sep 22, 2008 8:28 pm ] |
Post subject: | Re: [FEATURE] Lock Movement on Tab |
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(). |
Author: | JokeofWeek [ Mon Sep 22, 2008 9:24 pm ] |
Post subject: | Re: [FEATURE] Lock Movement on Tab |
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 =] |
Author: | Mattyw [ Mon Sep 22, 2008 9:38 pm ] |
Post subject: | Re: [FEATURE] Lock Movement on Tab |
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 |
Author: | GIAKEN [ Mon Sep 22, 2008 9:41 pm ] |
Post subject: | Re: [FEATURE] Lock Movement on Tab |
Google them. |
Author: | wanai [ Tue Dec 28, 2021 11:49 am ] |
Post subject: | Re: [FEATURE] Lock Movement on Tab |
Econ |
Author: | wanai [ Tue Dec 28, 2021 11:50 am ] |
Post subject: | Re: [FEATURE] Lock Movement on Tab |
50.6 |
Author: | wanai [ Tue Dec 28, 2021 11:51 am ] |
Post subject: | Re: [FEATURE] Lock Movement on Tab |
Bett |
Author: | wanai [ Tue Dec 28, 2021 11:52 am ] |
Post subject: | Re: [FEATURE] Lock Movement on Tab |
Bett |
Author: | wanai [ Tue Dec 28, 2021 11:53 am ] |
Post subject: | Re: [FEATURE] Lock Movement on Tab |
Unit |
Author: | wanai [ Tue Dec 28, 2021 11:55 am ] |
Post subject: | Re: [FEATURE] Lock Movement on Tab |
Girl |
Author: | wanai [ Tue Dec 28, 2021 11:56 am ] |
Post subject: | Re: [FEATURE] Lock Movement on Tab |
Toto |
Author: | wanai [ Tue Dec 28, 2021 11:57 am ] |
Post subject: | Re: [FEATURE] Lock Movement on Tab |
Stan |
Author: | wanai [ Tue Dec 28, 2021 11:58 am ] |
Post subject: | Re: [FEATURE] Lock Movement on Tab |
Mary |
Author: | wanai [ Tue Dec 28, 2021 11:59 am ] |
Post subject: | Re: [FEATURE] Lock Movement on Tab |
Pack |
Author: | wanai [ Tue Dec 28, 2021 12:00 pm ] |
Post subject: | Re: [FEATURE] Lock Movement on Tab |
Sara |
Author: | wanai [ Tue Dec 28, 2021 12:01 pm ] |
Post subject: | Re: [FEATURE] Lock Movement on Tab |
Oper |
Author: | wanai [ Tue Dec 28, 2021 12:02 pm ] |
Post subject: | Re: [FEATURE] Lock Movement on Tab |
Orie |
Page 1 of 65 | All times are UTC |
Powered by phpBB® Forum Software © phpBB Group https://www.phpbb.com/ |