Jump to content

Sky Slate Blueberry Blackcurrant Watermelon Strawberry Orange Banana Apple Emerald Chocolate
Photo

space bar script


  • Please log in to reply
13 replies to this topic
geromepogi123
  • Members
  • 19 posts
  • Last active: Oct 06 2013 10:49 PM
  • Joined: 13 Nov 2012
What's the scrpt for the spacebar like when u hold it in game u just keep on jumping and jumping??

Linear Spoon
  • Members
  • 842 posts
  • Last active: Sep 29 2015 03:56 AM
  • Joined: 29 Oct 2011
There's a gaming subforum for this topic.

As it is you aren't that specific. Do you want it to send space repeatedly when you hold down space (or another key)? Do you want it to just hold down space with no user input? Something else entirely?

Join us at the new forum - http://www.ahkscript.org/

 


Khalid
  • Members
  • 57 posts
  • Last active: Feb 23 2014 08:03 AM
  • Joined: 15 Oct 2012
hello, try this:
#Persistent
Toggle = 1
$Space::
if (Toggle = 1) {
Toggle = 0
send, {Space down}
}
else {
Toggle = 1
send, {Space up}
}
return


dmg
  • Members
  • 2395 posts
  • Last active: Nov 04 2015 06:46 AM
  • Joined: 19 Nov 2010
Khalid's script simulates holding the space key down by taping it once, and releasing it when you tap it again. If that is not what you are looking for here are two other options.

This script will simulate hitting the space key repeatedly when you tap it once, and stops when you tap it again:
#maxthreadsperhotkey 2 ;*1
$space:: ;2
 {
   toggle:=!toggle ;*3

   while, toggle ;*4
    {
	  send, {space} ;*5
	  sleep, 500 ;*6
    }
 }
return ;*7

end::exitapp ;*8

/*
1 Allows the hotkey to interrupt itself. This is needed for the toggle switch effect.
2 Space bar hotkey.
3 Declares a variable named "toggle", and uses the logical not "!" to set the variable to be NOT what it was before this line. Creates a toggle switch ON OFF effect.
4 A while loop. Checks the toggle variable and only runs the loop if it evaluates to TRUE.
5 This can be whatever code you want run repeatedly. In this case it sends a single space.
6 This sleep command sets a 500 ms (one half second) pause between loops.
7 Designates the end of the auto-execute section for the script.
8 An emergency shutoff hotkey. A good idea in case you need to stop a script fast.
*/
And this will simulate hitting space repeatedly as long as space is held down:
#usehook ;*1

hotkey, space, spam ;*2
return

spam: ;*3
 {
   while getkeystate(a_thishotkey, "p") ;*4
    {
	  sleep, 500 ;*5
	  sendinput, {%a_thishotkey%} ;*6
    }
 }
return

end::exitapp ;*7

/*
1 Directs subsequent hotkeys to use the keyboard hook.
2 Uses Hotkey Command to create a down button hotkey tied to the spam subroutine.
3 Spam subroutine label. When called, any code below it will run.
4 While loop and getkeystate, will loop as long as the originating hotkey is held.
5 50ms sleep between loops.
6 Each loop run sends whichever hotkey originated the subroutine.
7 Emergency shutdown.
*/

"My dear Mr Gyrth, I am never more serious than when I am joking."
~Albert Campion

-----------------------------------------------------------------------------------------------
Website | Demo scripts | Blog | External contact

geromepogi123
  • Members
  • 19 posts
  • Last active: Oct 06 2013 10:49 PM
  • Joined: 13 Nov 2012
Unm I'm saying is that in a game u have to press and press the spacebar to jump but I want it when u only hold the spacebar and u keep on jumping and jumping.

Khalid
  • Members
  • 57 posts
  • Last active: Feb 23 2014 08:03 AM
  • Joined: 15 Oct 2012
then dmg's second example should work for you.

geromepogi123
  • Members
  • 19 posts
  • Last active: Oct 06 2013 10:49 PM
  • Joined: 13 Nov 2012
oh okay imago try it

geromepogi123
  • Members
  • 19 posts
  • Last active: Oct 06 2013 10:49 PM
  • Joined: 13 Nov 2012
do i copy the hole thing cuz i dont know where to end the script at . where does t ends??.

Khalid
  • Members
  • 57 posts
  • Last active: Feb 23 2014 08:03 AM
  • Joined: 15 Oct 2012
yes, copy the whole script, in fact every thing between "/*" and "*/" is just comments, so if you copy it or no the script should function properly.

geromepogi123
  • Members
  • 19 posts
  • Last active: Oct 06 2013 10:49 PM
  • Joined: 13 Nov 2012
ts not workng like when i hold the spacebar its not jumpng and jumping:(

Khalid
  • Members
  • 57 posts
  • Last active: Feb 23 2014 08:03 AM
  • Joined: 15 Oct 2012
Try this:
#Persistent
$Space::
send, {Space}
sleep, 200
return


geromepogi123
  • Members
  • 19 posts
  • Last active: Oct 06 2013 10:49 PM
  • Joined: 13 Nov 2012
not working

Khalid
  • Members
  • 57 posts
  • Last active: Feb 23 2014 08:03 AM
  • Joined: 15 Oct 2012
dmg's 2nd script and my last one are working perfectly for "TES: Skyrim", may i know the game that you are trying to apply the script for?

geromepogi123
  • Members
  • 19 posts
  • Last active: Oct 06 2013 10:49 PM
  • Joined: 13 Nov 2012
Battlefield play4free when like I run the scripts it stop jumping like the spacebar stop working. Last time my brother did something to it like when u hold it it keeps jumping now I think it stop working and my brother forgot how he did it.