Page 1 of 1
Scroll to change items in ARK.
Posted: 16 Jan 2018, 11:03
by TrippyHippyDan
Hi all,
I had noticed that there were no posts on an easy way to do this, so for the community I would like to share this code. It allows your scroll wheel to change items in ARK, or other games really, the same way it does in Minecraft. If there are any suggested edits please make them and post!
Code: Select all
;------------ ARK: Survival Evolved -----------------
WheelUp::
IfWinActive, ARK: Survival Evolved
{
if (ARKSCROLL < 9)
{
ARKSCROLL := ARKSCROLL + 1
sleep, 10
send, %ARKSCROLL%
Return
}
if (ARKSCROLL >= 9)
{
ARKSCROLL = 0
sleep, 10
send, %ARKSCROLL%
Return
}
Return
}
IfWinNotActive, ARK: Survival Evolved
send, {WheelUp}
Return
WheelDown::
IfWinActive, ARK: Survival Evolved
{
if (ARKSCROLL > 0)
{
ARKSCROLL := ARKSCROLL - 1
sleep, 10
send, %ARKSCROLL%
Return
}
if (ARKSCROLL <= 0)
{
ARKSCROLL = 9
sleep, 10
send, %ARKSCROLL%
Return
}
Return
}
IfWinNotActive, ARK: Survival Evolved
send, {WheelDown}
Return
Re: Scroll to change items in ARK.
Posted: 18 Jan 2018, 07:07
by evilC
1) Put the IfWinActive line
before the hotkey line. If you did this, you would not need the
IfWinNotActive to send WheelUp, as the block simply would not happen if the app was not active.
Code: Select all
WheelUp::
IfWinActive, ARK: Survival Evolved
2) If this is a finished script, put it in the "Scripts and Functions" forum
3) This code seems a little off...
Code: Select all
if (ARKSCROLL < 9)
{
ARKSCROLL := ARKSCROLL + 1
sleep, 10
send, %ARKSCROLL%
Return
}
if (ARKSCROLL >= 9)
{
ARKSCROLL = 0
sleep, 10
send, %ARKSCROLL%
Return
}
Is the intention that this code only sends 1-8? It looks like you are maybe trying to send 1-9, but this code will never send 9.
It also needlessly repeats logic and send code, you only need one send and one sleep - just make sure you increment and do the wrap-around before you hit that point, like so:
Code: Select all
ARKSCROLL++ ; A shorthand way of saying ARKSCROLL := ARKSCROLL + 1
if (ARKSCROLL > 9){
ARKSCROLL := 0
}
sleep, 10 ; Not too sure why you would want to sleep BEFORE sending the key?
send, %ARKSCROLL%
Return
Re: Scroll to change items in ARK.
Posted: 19 Jan 2018, 15:08
by TrippyHippyDan
1) Thanks for that I was thinking it would work but tested the other route just in case. (which is less efficient, but could come in handy for other things, and as is if I am holding shift it does not change to other weapons on me if I am running.)
2) It was and it wasn't, as you found there were areas that could have been improved.
3. Its 0-9 not 1-9, but I can confirm it does hit 9 as the code currently is in the initial post.
I will have to look into if that changes using "IfWinActive" before the wheel up instead of the after, or if it will effect everything behind it in my usual running scrip or return properly.
Re: Scroll to change items in ARK.
Posted: 19 Jan 2018, 16:53
by evilC
TrippyHippyDan wrote:
3. Its 0-9 not 1-9, but I can confirm it does hit 9 as the code currently is in the initial post.
Yeah, sorry, I obviously mis-read it, but it is still not doing what you think it is
It does 1 to 0, with the 9th iteration sending both 9 and 0
Your code, with sends replaced with logging:
Code: Select all
#SingleInstance force
ARKSCROLL := 0
output := ""
Loop 10
{
if (ARKSCROLL < 9)
{
ARKSCROLL := ARKSCROLL + 1
output .= "Iteration # " A_Index ": " ARKSCROLL "`n"
}
if (ARKSCROLL >= 9)
{
ARKSCROLL = 0
output .= "Iteration # " A_Index ": " ARKSCROLL "`n"
}
}
clipboard := output
msgbox % output
Result (Iteration 9 would have done 2 sends because you used
if, not
else if)
Iteration # 1: 1
Iteration # 2: 2
Iteration # 3: 3
Iteration # 4: 4
Iteration # 5: 5
Iteration # 6: 6
Iteration # 7: 7
Iteration # 8: 8
Iteration # 9: 9
Iteration # 9: 0
Iteration # 10: 1
My code:
Code: Select all
#SingleInstance force
ARKSCROLL := 0
output := ""
Loop 10
{
ARKSCROLL++ ; A shorthand way of saying ARKSCROLL := ARKSCROLL + 1
if (ARKSCROLL > 9){
ARKSCROLL := 0 ; Changing this to 1 will make it send 1-9 instead of wrapping around to 0
}
output .= "Iteration # " A_Index ": " ARKSCROLL "`n"
}
clipboard := output
msgbox % output
Result:
Iteration # 1: 1
Iteration # 2: 2
Iteration # 3: 3
Iteration # 4: 4
Iteration # 5: 5
Iteration # 6: 6
Iteration # 7: 7
Iteration # 8: 8
Iteration # 9: 9
Iteration # 10: 0
Re: Scroll to change items in ARK.
Posted: 19 Jan 2018, 17:30
by TrippyHippyDan
@evilC Thanks for that. I had't been using anything in slot 0 or 9 enough to notice it yet, but it defiantly could have gotten annoying!
Re: Scroll to change items in ARK.
Posted: 19 Jan 2018, 17:46
by TrippyHippyDan
@evilC Still working on this further because I want to go from 1 - 0 and then if I keep scrolling up go back through the list, but with your help this does it and there are no doubles scrolling up or down!
Code: Select all
SetTitleMatchMode, 2
ARKSCROLL := 0
;------------ ARK: Survival Evolved -----------------
#IfWinActive, ARK: Survival Evolved
WheelUp::
{
if (ARKSCROLL < 9)
{
ARKSCROLL := ARKSCROLL + 1
sleep, 10
send, %ARKSCROLL%{Enter}
Return
}
if (ARKSCROLL >= 9)
{
ARKSCROLL = 0
sleep, 10
send, %ARKSCROLL%{Enter}
Return
}
Return
}
Return
#IfWinActive, ARK: Survival Evolved
WheelDown::
{
if (ARKSCROLL >= 1)
{
ARKSCROLL := ARKSCROLL - 1
sleep, 10
send, %ARKSCROLL%{Enter}
Return
}
if (ARKSCROLL <= 0)
{
ARKSCROLL = 9
sleep, 10
send, %ARKSCROLL%{Enter}
Return
}
Return
}
Return
Re: Scroll to change items in ARK.
Posted: 19 Jan 2018, 19:04
by evilC
As I said, replace your two IF statements with the way I do it.
You get the same result, and it is WAY more elegant.
Having the send in two places when you not need to makes the code harder to maintain and understand.
Hell, you do not even need to repeat the same code for wheel up and down, you can do the whole lot with one function
Code: Select all
WheelUp::
DoSend(1)
return
WheelDown::
DoSend(-1)
return
DoSend(dir){
global ARKSCROLL ; static ARKSCROLL would also work
ARKSCROLL := ARKSCROLL + dir ; Works for positive and negative! 2 plus -1 is 1 !!
if (ARKSCROLL > 9){
ARKSCROLL := 0
} else if (ARKSCROLL < 0){
ARKSCROLL := 9
}
Send %ARKSCROLL%{Enter}
}
Re: Scroll to change items in ARK.
Posted: 19 Jan 2018, 20:06
by TrippyHippyDan
@evilC
That is a lot cleaner and looking closer to python than AHK. (AHK the deeper I get into it feels more and more like a mixed bag of other languages @.@) Thanks much I didn't know you could define objects so that was a huge help!
Re: Scroll to change items in ARK.
Posted: 03 Jul 2019, 20:40
by FC360
Sorry to revive a old thread but I've been trying to use this on ark and it works in single player It doesn't work well in multiplayer as it keeps opening chat everytime I scroll and if I keep scrolling it sends the number in chat, how do I stop this?
Re: Scroll to change items in ARK.
Posted: 16 Jan 2020, 10:10
by G1NGER_DAVE
FC360 wrote: ↑03 Jul 2019, 20:40
Sorry to revive a old thread but I've been trying to use this on ark and it works in single player It doesn't work well in multiplayer as it keeps opening chat everytime I scroll and if I keep scrolling it sends the number in chat, how do I stop this?
I know this is an old post but just in case anyone else stumbles across it as I did you just need to remove {Enter} from the end as its not required and causes the chat window to open. Thanks everyone for this it is so nice being able to use the scroll wheel in Ark.
Re: Scroll to change items in ARK.
Posted: 16 Jan 2020, 10:16
by G1NGER_DAVE
What would I need to put to make the mouse wheel click resend the current number. Asking because if your building and have allot of the same structure assigned to a number in the hotbar you have to keep clicking that number to place another one.
Re: Scroll to change items in ARK.
Posted: 16 Jan 2020, 10:51
by G1NGER_DAVE
Dont worry figured it out. I just added
MButton::
Send %ARKSCROLL%
return
Also seems the script doesnt run while holding down left shift so you can just hold this to use scroll for cupboards, fliers, rafts & 3rd person
So now im using the below and its all good
Code: Select all
;------------ ARK: Survival Evolved -----------------
#IfWinActive, ARK: Survival Evolved
WheelUp::
DoSend(1)
return
WheelDown::
DoSend(-1)
return
MButton::
Send %ARKSCROLL%
return
DoSend(dir){
global ARKSCROLL
ARKSCROLL := ARKSCROLL + dir
if (ARKSCROLL > 9){
ARKSCROLL := 0
} else if (ARKSCROLL < 0){
ARKSCROLL := 9
}
Send %ARKSCROLL%
}
Thanks everyone, this is so nice.
Re: Scroll to change items in ARK.
Posted: 07 Jun 2020, 10:45
by blackpoolfc04
G1NGER_DAVE wrote: ↑16 Jan 2020, 10:51
Dont worry figured it out. I just added
MButton::
Send %ARKSCROLL%
return
Also seems the script doesnt run while holding down left shift so you can just hold this to use scroll for cupboards, fliers, rafts & 3rd person
So now im using the below and its all good
Code: Select all
;------------ ARK: Survival Evolved -----------------
#IfWinActive, ARK: Survival Evolved
WheelUp::
DoSend(1)
return
WheelDown::
DoSend(-1)
return
MButton::
Send %ARKSCROLL%
return
DoSend(dir){
global ARKSCROLL
ARKSCROLL := ARKSCROLL + dir
if (ARKSCROLL > 9){
ARKSCROLL := 0
} else if (ARKSCROLL < 0){
ARKSCROLL := 9
}
Send %ARKSCROLL%
}
Thanks everyone, this is so nice.
I am having issues with this. The feature where you can hold shift and still go into third-person works, however the scrolling hotbar doesn't work. I am not very good at this type of stuff so bear with me
Re: Scroll to change items in ARK.
Posted: 27 Jan 2022, 15:37
by Nova1340
Hello it's a very old message but I'm not good at all
, can you tell me where to put this code please
Re: Scroll to change items in ARK.
Posted: 27 Jan 2022, 15:41
by Nova1340
I play ark on epic game launcher
Re: Scroll to change items in ARK.
Posted: 31 Jan 2022, 15:12
by sai05
Nova1340 wrote: ↑27 Jan 2022, 15:41
I play ark on epic game launcher
im new about scrip , reading every one scrip
quck question
what "Send %ARKSCROLL%" do ?