Jump to content

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

Help with simple DDO script, very simple, but beats me B)



  • Please log in to reply
50 replies to this topic
jessebarbier
  • Members
  • 49 posts
  • Last active: Nov 16 2013 06:01 AM
  • Joined: 25 Sep 2013

Okay, basically I just need help setting up a simple script to make one hotkey alternate buttons.

For example, when I press the a button, the first time it'd fire A, and then if I press again, it'd fire B, so on, so forth.

I want this so I can make spell or skill sets to one key, so I don't have to keep searching for my buttons.

 

After a bit of toying around, I managed to make a script that worked in notepad or explorer, But it won't work in game.

var = 1             ; setting the variable in advance
z::                  ; using the "Z" hotkey
If(var = 1)           ; I know I just made it 1, but only way I could alternate the output
{                      ; BRACKET
SendInput a             ; It is firing the A button in anything BUT the game I want
var = 2                  ; Changing the variable to 2 to change output in else
}                          ; CLOSE THE BRACKET BRUH

else {                      ; OR ELSE I JUST WONT WORK ;)
SendInput b                ; The output is changing now
var = 1                   ; Changing the variable back, so it'll start back at A
}
return                   ; Return of the JEDI

This is the code I got to work outside of the game, I tested just using remapped keys ingame (A::C) and it worked fine, but when I reloaded this script it wouldn't.

 

Please and thank you in advance to anyone who can help me out here, I know there has got to be something I'm doing wrong, please just point it out for me grin.png or if you have better ideas in script, do tell, ty much



Butters
  • Members
  • 22 posts
  • Last active: Mar 08 2014 02:00 AM
  • Joined: 15 Sep 2013

i could never get a script to work for DDO either. i didnt try hard.

did you try "run as admin" ?

maybe SendPlay or SendRaw



jessebarbier
  • Members
  • 49 posts
  • Last active: Nov 16 2013 06:01 AM
  • Joined: 25 Sep 2013

i could never get a script to work for DDO either. i didnt try hard.

did you try "run as admin" ?

maybe SendPlay or SendRaw

 

I believe I tried all the send modes besides send raw, about to give it a shot and will reply with results.

Also, I have been running in admin, with no success ( I don't run the game as admin anyway)



jessebarbier
  • Members
  • 49 posts
  • Last active: Nov 16 2013 06:01 AM
  • Joined: 25 Sep 2013

Yeah still no luck with SendRaw.

Still, simple remaps work in game, but don't think this is of any significance since I can remap in the game options (Z::A)

 

But its not even noticing me hit Z in the AHK logs (while I'm in game) the logs only show the Var=1 being executed, and no other parts of the script, until I alt tab out and hit Z, It'll execute while I'm out of game, but not in game.

 

Also, I found a method to achieve alternating hotkeys, (only up to 3 buttons per 1 physical button) by using vjoy (virtual joypad) which can block the keys from DDO, then I use JoyToKey to take the "joypad" button (actually off the keyboard / vJoy) and make it variate between 3 buttons. (the JoyToKey alternating keys feature is what inspired me to try this script to begin with, cause I wanted alternation on my keyboard, not just my joypad) This is a temporary fix for my issue, but I'd like to figure out how to get the scripts running in game, so I could add cooldowns to the alternating pattern, so it'd skip skills in cooldown. And, lets face it, having to keymap 3 different programs just to play the game sucks :p so eliminating vjoy and JoyToKey would be great.



Grendahl
  • Members
  • 416 posts
  • Last active: Jul 07 2014 08:01 PM
  • Joined: 10 Aug 2009

If I recall correctly, I had to run DDO in windowed fullscreen, compile the script, and run the exe as admin to get it to work... but it's been years since I've played it.


Always have your scripts when you need them with Dropbox.
Sign up for free! http://db.tt/9Hrieqj

jessebarbier
  • Members
  • 49 posts
  • Last active: Nov 16 2013 06:01 AM
  • Joined: 25 Sep 2013

If I recall correctly, I had to run DDO in windowed fullscreen, compile the script, and run the exe as admin to get it to work... but it's been years since I've played it.

Slightly confused on whether you mean windowed, or fullscreen.

I tried compiling it to an exe and running as admin. In both full and windowed, still no success though.

Scratch that, compiling and admin did help me get a script to run in game. But a different script than I need. Seems I'm still missing something in my own script.

 

Is there a way to code the script to block a certain key from the game? Thinking maybe the directinput, or whatever the game is using, is "stealing" or stopping the keys from being recognized by AHK while the game is active. Also, what "send" mode is being used when you just put blankly (A::Z) in a script? The game recognizes the A/Z swap.



Temil2008
  • Members
  • 364 posts
  • Last active: Jun 14 2015 09:02 PM
  • Joined: 10 Dec 2012

have you tried changing "SendInput" to "ControlSend" ?

 

example :

varlist = a|b|c|d|e|f|g

Loop, parse, varlist, |
	var%A_Index% := A_LoopField

num = 1

WinGet, GameID, ID, ahk_class Notepad

#IfWinActive, ahk_class Notepad
z::
If(var%Num% != "")
{
	ControlSend, , % var%Num%, ahk_id %GameID%
	num++
}
else
{
	ControlSend, , z, ahk_id %GameID%
	num = 1
}
return

you will need to change the 2 spots where it says "Notepad" to the ahk_class that is obtained with windowsspy for the game you are running. I have never played it, so not sure what the ahk_class is.


________________________________________________________________

Did a solution provided fix your issue? please mark as "Answered" if so. thank you!


jessebarbier
  • Members
  • 49 posts
  • Last active: Nov 16 2013 06:01 AM
  • Joined: 25 Sep 2013

I re-wrote my script, I'm not quite sure why this one worked, and the other one didn't. Here is an example of how it was written.

var = 1
z::Goto , Here

Here:
If (var=1) {
	Send , A
	var = 2
}Else If (var = 2) {
	Send, B
	var = 3
	Return
}

The only real difference here is I used "Else if" instead of "Else"

I also used a label thinking maybe that it'd make a difference.

 

EDIT:: Seems there is a trick to get them to work or not, I am not sure what I did the first time, the new script above worked (it was compiled and admin) Second time, I started DDO, then the /exe as admin and it did not work.



jessebarbier
  • Members
  • 49 posts
  • Last active: Nov 16 2013 06:01 AM
  • Joined: 25 Sep 2013

have you tried changing "SendInput" to "ControlSend" ?

 

example :

varlist = a|b|c|d|e|f|g

Loop, parse, varlist, |
    var%A_Index% := A_LoopField

num = 1

WinGet, GameID, ID, ahk_class Notepad

#IfWinActive, ahk_class Notepad
z::
If(var%Num% != "")
{
    ControlSend, , % var%Num%, ahk_id %GameID%
    num++
}
else
{
    ControlSend, , z, ahk_id %GameID%
    num = 1
}
return

you will need to change the 2 spots where it says "Notepad" to the ahk_class that is obtained with windowsspy for the game you are running. I have never played it, so not sure what the ahk_class is.

 

 

I'll try this script with the class changed, and see how it works. Sorry I'm a noob xD your script blows me away with your use of variables.



Temil2008
  • Members
  • 364 posts
  • Last active: Jun 14 2015 09:02 PM
  • Joined: 10 Dec 2012

 

 

 

I'll try this script with the class changed, and see how it works. Sorry I'm a noob xD your script blows me away with your use of variables.

 

 

lol, not really that complicated. baslicly it's just assigning a variable number to each key, so that if you have to make changes , you only need to change the varlist on top is all.

 

copy the script exactly, open notepad, then run the script and test it there, you will see what i mean.

once it's confirmed there, then test it with the game directly, but again, dont forget to change Notepad in the 2 spot, to the ahk_class for the  game.


________________________________________________________________

Did a solution provided fix your issue? please mark as "Answered" if so. thank you!


jessebarbier
  • Members
  • 49 posts
  • Last active: Nov 16 2013 06:01 AM
  • Joined: 25 Sep 2013

have you tried changing "SendInput" to "ControlSend" ?

 

you will need to change the 2 spots where it says "Notepad" to the ahk_class that is obtained with windowsspy for the game you are running. I have never played it, so not sure what the ahk_class is.

Okay, well your script, works, and doesn't at the same time. For both notepad and DDO (depending on whether or not I changed the ahk_class)

when in the program specified in script, pressing Z did nothing. But that means it got loaded in DDO as well, because it did nothing there (if it was unloaded, Z would show when typed) Gonna try to see if I can tinker out the issue.



jessebarbier
  • Members
  • 49 posts
  • Last active: Nov 16 2013 06:01 AM
  • Joined: 25 Sep 2013

lol, not really that complicated. baslicly it's just assigning a variable number to each key, so that if you have to make changes , you only need to change the varlist on top is all.

 

copy the script exactly, open notepad, then run the script and test it there, you will see what i mean.

once it's confirmed there, then test it with the game directly, but again, dont forget to change Notepad in the 2 spot, to the ahk_class for the  game.

The test in notepad didn't work, nor DDO.

BUT

when I took control send out, and just used "Send , _yourVariable_" it worked perfectly, both in notepad and in game.

varlist = a|b|c|d|e|f|g

Loop, parse, varlist, |
	var%A_Index% := A_LoopField

num = 1

WinGet, GameID, ID, ahk_class Notepad

#IfWinActive, ahk_class Turbine Device Class
z::
If(var%Num% != "")
{
	Send , % var%Num%
	num++
}
else
{
	Send , Z
	num = 1
}
return

Edited version ^

 

Also, how would I stop it from putting Z at the end of the cycle, it goes a-g then Z

Thank you immensely for your help, just started coding a couple nights ago :D



Temil2008
  • Members
  • 364 posts
  • Last active: Jun 14 2015 09:02 PM
  • Joined: 10 Dec 2012

Okay, well your script, works, and doesn't at the same time. For both notepad and DDO (depending on whether or not I changed the ahk_class)

when in the program specified in script, pressing Z did nothing. But that means it got loaded in DDO as well, because it did nothing there (if it was unloaded, Z would show when typed) Gonna try to see if I can tinker out the issue.

are you running the game fullscreen? windowed? borderless windowed? .. can you try it windowed and see if that works? it would at least tell us if the commands are being reconized, we can then alter it for fullscreen after that.


________________________________________________________________

Did a solution provided fix your issue? please mark as "Answered" if so. thank you!


Temil2008
  • Members
  • 364 posts
  • Last active: Jun 14 2015 09:02 PM
  • Joined: 10 Dec 2012

 

The test in notepad didn't work, nor DDO.

BUT

when I took control send out, and just used "Send , _yourVariable_" it worked perfectly, both in notepad and in game.

 

gotcha, so ya good? anything else we can help with? =)

it worked for me in notepad, not sure about the game for ya, but at least ya got it working.


________________________________________________________________

Did a solution provided fix your issue? please mark as "Answered" if so. thank you!


jessebarbier
  • Members
  • 49 posts
  • Last active: Nov 16 2013 06:01 AM
  • Joined: 25 Sep 2013

Would adding else if turbine isn't running to the "send z" part stop Z from being sent at the end of the cycle in game?

 

Almost good :p you've gotten me alot more progress than I had the night before.

Next step is figuring out a way to add in cooldown timers for each letter (example: wait 10 secs before a is available, wait 5 secs before B, wait 15 secs for C, wait 0.5 for D) so on so forth.

 

Awesome help from all of you guys, Thank you!!