![]() |
|
[FEATURE] Lock Movement on Tab - Printable Version +- Mirage Source (https://mirage-engine.uk/forums) +-- Forum: Mirage Source (Nostalgia) (https://mirage-engine.uk/forums/forumdisplay.php?fid=61) +--- Forum: Archive (2006-2011) (https://mirage-engine.uk/forums/forumdisplay.php?fid=18) +---- Forum: Source Code Development (https://mirage-engine.uk/forums/forumdisplay.php?fid=51) +----- Forum: Mirage Source 4 (Visual Basic 6) (https://mirage-engine.uk/forums/forumdisplay.php?fid=44) +------ Forum: Tutorials (https://mirage-engine.uk/forums/forumdisplay.php?fid=13) +------ Thread: [FEATURE] Lock Movement on Tab (/showthread.php?tid=2162) |
[FEATURE] Lock Movement on Tab - JokeofWeek - 22-09-2008 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 varsAnd in that little section, add : Code: Public IsUserTabbed As BooleanIn modConstants, look for : Code: Public Const VK_CONTROL As Long = &H11And under it add : Code: Public Const VK_TAB as long = &H9Now, in modGameLogic, look for sub GameLoop. Add the following variable at the top, inside that sub : Code: Dim TabTimer as longand then look for the following snippet : Code: If GetAsyncKeyState(VK_CONTROL) >= 0 Thenand add this under : Code: If GetAsyncKeyState(VK_TAB) 0 ThenNow, 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 runningAnd replace it with : Code: ' Check if player has the shift key down for runningThis 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?
Re: [FEATURE] Lock Movement on Tab - Nean - 22-09-2008 Didn't work for me. I press tab, but it doesn't do anything. Maybe I did the tut wrong. Re: [FEATURE] Lock Movement on Tab - JokeofWeek - 22-09-2008 Sorry about that, updated it now
Re: [FEATURE] Lock Movement on Tab - Nean - 22-09-2008 Works now. Awesome job dude. Re: [FEATURE] Lock Movement on Tab - skillzalot - 22-09-2008 I added this feature into my client good job. Re: [FEATURE] Lock Movement on Tab - Kousaten - 22-09-2008 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.
Re: [FEATURE] Lock Movement on Tab - Mattyw - 22-09-2008 Kind of an off/on-topic note: Code: Public Const VK_CONTROL As Long = &H11how do you get the &H11? Just make it up? Re: [FEATURE] Lock Movement on Tab - Jacob - 22-09-2008 I found this snippet of code awhile ago: Code: ' Used so we can actually use the tab key ingameThis will allow you use tabkey without any problems. It would get added Form_Load(). Re: [FEATURE] Lock Movement on Tab - JokeofWeek - 22-09-2008 Mattyw Wrote:Kind of an off/on-topic note: Nah, &H11 is the hexadecimal value for that Key ![]() Dugor Wrote:I found this snippet of code awhile ago: Ah nice, I modify it to use that Thanks mate =]
Re: [FEATURE] Lock Movement on Tab - Mattyw - 22-09-2008 JokeofWeek Wrote:Mattyw Wrote:Kind of an off/on-topic note: So how do I find the Hex value of keys. :S Re: [FEATURE] Lock Movement on Tab - GIAKEN - 22-09-2008 Google them. |