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
Temil2008
  • Members
  • 364 posts
  • Last active: Jun 14 2015 09:02 PM
  • Joined: 10 Dec 2012

well, you could do a bunch of elseif's.. but then the fact of keeping it simple and using variables kind of goes out the window then =). you would also have to do each and every key as an elseif.

 

it's accually simple to do this, but need a little more detail on what you want it to do..

 

Option 1 :

     Check A>B>C>D>E>F>G ..

     locate "first_one" that is avalible and use it,

     stop after first one located

     repeat (starting over the sequence from A>B>etc)

 

Option 2 :

     Same as Option 1, but instead of starting over at A when first one is found to be ready, it would start checking from next one in the list

     example : if A isn't ready, B isn't ready, but C is ready.. then C is used... next time pressed, D is checked

 

and yes, to add additional keys, you just add to the 2 variables.


________________________________________________________________

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

I was just looking at the code, and re-reading what you wanted. sounds like you want same function, just for it to act 1 way when held, and 1 way when released?? if so, try this (removed X key, as was kind of redundant since you wanted same functionality)

varlist = a|b|c|d|e|f|g
VarRecast = 1000|2000|3000|4000|5000|6000|7000
PauseSec = 500

num = 1

Loop, parse, varlist, |
{
	CurrentIndex := A_Index
	MaxNum := A_Index+1
	var%A_Index%_key := A_LoopField
	Loop, parse, VarRecast, |
	{
		if (A_Index = CurrentIndex)
			var%A_Index%_recast := A_LoopField
	}
}

#IfWinActive, ahk_class Notepad
z::
Loop
{
	Loop, parse, varlist, |
	{
		Num = 1
		if (Start%A_Index% = "")
		{
			Send , % var%A_Index%_key
			Start%A_Index% := A_TickCount
			Sleep, %PauseSec%
		}
		else
		{
			Elapsed%A_Index% := A_TickCount - Start%A_Index%
			if (Elapsed%A_Index% >= Var%A_Index%_recast)
			{
				Send , % var%A_Index%_key
				Start%A_Index% := A_TickCount
				Sleep, %PauseSec%
			}
		}
		if  (GetKeyState("z", "P") = 0)
			break
	}
	break
}
return

if you want to use the more powerfully (and longer cooldown skills) first .. place them in the begining of the varlist variable and the shorter, less powerfull ones to the end of it.

I have it pointing at Notepad, you will need to change that back to your game,as I do the testing to notepad.


________________________________________________________________

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

well, you could do a bunch of elseif's.. but then the fact of keeping it simple and using variables kind of goes out the window then =). you would also have to do each and every key as an elseif.

 

it's accually simple to do this, but need a little more detail on what you want it to do..

 

Option 1 :

     Check A>B>C>D>E>F>G ..

     locate "first_one" that is avalible and use it,

     stop after first one located

     repeat (starting over the sequence from A>B>etc)

 

Option 2 :

     Same as Option 1, but instead of starting over at A when first one is found to be ready, it would start checking from next one in the list

     example : if A isn't ready, B isn't ready, but C is ready.. then C is used... next time pressed, D is checked

 

and yes, to add additional keys, you just add to the 2 variables.

Yeah until you went epic, the bunch of "else ifs" was my plan. As far as between these two options, I believe option 2 would be the preferred way, but honestly either way is functional, as long as it skips the "dead" moves.

 

I was just looking at the code, and re-reading what you wanted. sounds like you want same function, just for it to act 1 way when held, and 1 way when released?? if so, try this (removed X key, as was kind of redundant since you wanted same functionality)

varlist = a|b|c|d|e|f|g
VarRecast = 1000|2000|3000|4000|5000|6000|7000
PauseSec = 500

num = 1

Loop, parse, varlist, |
{
	CurrentIndex := A_Index
	MaxNum := A_Index+1
	var%A_Index%_key := A_LoopField
	Loop, parse, VarRecast, |
	{
		if (A_Index = CurrentIndex)
			var%A_Index%_recast := A_LoopField
	}
}

#IfWinActive, ahk_class Notepad
z::
Loop
{
	Loop, parse, varlist, |
	{
		Num = 1
		if (Start%A_Index% = "")
		{
			Send , % var%A_Index%_key
			Start%A_Index% := A_TickCount
			Sleep, %PauseSec%
		}
		else
		{
			Elapsed%A_Index% := A_TickCount - Start%A_Index%
			if (Elapsed%A_Index% >= Var%A_Index%_recast)
			{
				Send , % var%A_Index%_key
				Start%A_Index% := A_TickCount
				Sleep, %PauseSec%
			}
		}
		if  (GetKeyState("z", "P") = 0)
			break
	}
	break
}
return

if you want to use the more powerfully (and longer cooldown skills) first .. place them in the begining of the varlist variable and the shorter, less powerfull ones to the end of it.

I have it pointing at Notepad, you will need to change that back to your game,as I do the testing to notepad.

You guy are just awesome lol, do you ever sleep? tongue.png I went to sleep, and woke up to this epic one. This actually wasn't how I pictured it, but you read my mind lol, because I love how its combined into one key, (you sir were thinking on the right page)

 

Noticed that on the new one, when holding the Z key, it functions perfectly, cycling exactly as planned. But when you just press it, the letters come out a random order (a b a a a a a a a b a c d e f a b a c) is the order I got just now using the script.

 

Edit: I increased the time for the A key (was still at 1 second) and it solved the problem, fires off about 99% correctly now

(a b c d e f a b c d e f a b c d e f a b c d e f a b g) Here, everything is at 5 seconds besides G

 

 

If it is too much trouble to keep it combined to one key, them being separate will work fine ( I have enough open keys) You have blown me away with how you keep making it better each time xD Thank you tons!!!

 

Sorry just woke up here, sorry if I missed any questions, gonna read back over it after breakfast, if I missed anything I'll post again



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

I was just looking at the code, and re-reading what you wanted. sounds like you want same function, just for it to act 1 way when held, and 1 way when released??

Missed this question when I read over the first time. My reference to holding it down earlier was meant if you couldn't get it to work with a single press at a time, But I like the way you made it now, cause I can hold it, or press it grin.png so perfect, best of both worlds

 

and I can still copy the burst method from earlier scripts and use it on another key for being lazy at times, best of 3 worlds grin.png

 

Got some work to do, so won't have a chance to try this out in game for a bit. But can't wait to try it out. (My DPS is going to go up for sure!!)



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

So far so good, Haven't used this in "battle" yet, but I tested it on some practice dummies, only flaw I saw is that when holding it down, it seems to start skipping a certain skill depending on what times were left when I held the button. Most commonly the third button. Not a huge issue, if you feel like looking into it you can, if not I'll just deal with it :p you've already helped me out more than I expected. Thanks a bunch, I owe you one.

varlist = 1|2|3|4|5|6|z
VarRecast = 15000|10000|5000|30000|10000|10000|100
PauseSec = 500

num = 1

Loop, parse, varlist, |
{
	CurrentIndex := A_Index
	MaxNum := A_Index+1
	var%A_Index%_key := A_LoopField
	Loop, parse, VarRecast, |
	{
		if (A_Index = CurrentIndex)
			var%A_Index%_recast := A_LoopField
	}
}

#IfWinActive, ahk_class Turbine Device Class
a::
Loop
{
	Loop, parse, varlist, |
	{
		Num = 1
		if (Start%A_Index% = "")
		{
			Send , % var%A_Index%_key
			Start%A_Index% := A_TickCount
			Sleep, %PauseSec%
		}
		else
		{
			Elapsed%A_Index% := A_TickCount - Start%A_Index%
			if (Elapsed%A_Index% >= Var%A_Index%_recast)
			{
				Send , % var%A_Index%_key
				Start%A_Index% := A_TickCount
				Sleep, %PauseSec%
			}
		}
		if  (GetKeyState("a", "P") = 0)
			break
	}
	break
}
return

Current script ^

 

Thanks a bunch, awesome skills :D



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

um.. are you sure it's skipping the skills and not simply going to fast, to where it's firing off before it's fully ready?

 

tested this to Notepad, and here is the results, which is why i'm asking the question. As you can see, all of the keys got sent over the period of time that i held down the "a" key.

123456zzzzzz3zzzzzzzz23z56zzz1zz3zzzzzzzz23z56zzzzzz3zzzzz1zz23456zzzz

________________________________________________________________

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

Once I get a chance I'll check to see if the skill before it has a longer "cast time" or animation. I'll also add an extra 200ms to the "recast time" for the 3rd skill and see if it solves the issue. Additionally I can add another 100-200ms to the pause/cast time (just trying to keep them as fast as possible). Seemed like it only happened after I had pressed and held and released and held again a few times, so I figured it had to do with the multiple recasts counting down while repressing the button. Its not such a big deal because if it skips that one I can see it visually and just repress the button and it resets fine.

 

Either way, its alot better than pressing 1 2 3 4 5 6 in a row and having to visually check the cooldowns each time I run through them. So thanks a ton.



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

np.. one thing you could test...

 

get it to where you are saying that it stops working..then release, and wait 1-2 seconds longer then your longest cast timer to reset.. then press/hold it again and see if it activates the skiped number.


________________________________________________________________

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

You were right :D it was just firing off a bit too fast, it 3 would work when 4 was "cooling off" but if 4 was ready it took priority.

Increased "cast time" to 600ms (from 500) works like a charm now, not quite as fast, but perfect.

Thanks a ton!!!



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

Also one more question, I'm gonna end up using this for more than one function in the game. So when I go to copy this to another hotkey in the same script, what all will I need to rename? Is it just the VarList, VarRecast, and PauseSec, or is there more to it?



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

well, you talkin about having 2 of these runing at 1 time, or simply wanting to add to the current list?


________________________________________________________________

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

Two of these running for different keys, one ( A = 1-6z) two (S = 1-6 on numpad)

 

But actually, I'll probably use the burst script for any additional keys. They will be just for saving time switching between items, or taking potions etc.

Basically I have 2 shortcut bars in game, They both range from numbers 1-9 the one I'm using now is for combat, the other will be for items and such.



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

if you want to duplicate this into a 2nd hotkey, it's a bit more then simply copy/pasting it. All of the variables need to have there one variation for different hotkeys. I can work on that, but before i do, let me know if it's really desired =) ..  just want to make sure before i spend the time on it.


________________________________________________________________

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

Nah, if its gonna take you any more time I'll just figure it out, I thought it may be as simple as copy paste, and renaming the vars.

Thanks a bunch though!!!



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

download link here for updated script.

https://www.dropbox....t Hotkeys.ahk?m


________________________________________________________________

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