Simple number manipulation Topic is solved
Simple number manipulation
Hi all, essentially all I need is manipulation of two numbers
- Start is 1,14
and a dictionary of
- If aa,bb is active, and right is pressed change to cc,gg (cc,gg are any integers I choose)’
- if left was pressed instead of write, would have changed to different integers, i.e. to bb,dd
that is all
just need a function to allow me to manually modify the desired sequences, as opposed to me writing out each individual if statement
- Start is 1,14
and a dictionary of
- If aa,bb is active, and right is pressed change to cc,gg (cc,gg are any integers I choose)’
- if left was pressed instead of write, would have changed to different integers, i.e. to bb,dd
that is all
just need a function to allow me to manually modify the desired sequences, as opposed to me writing out each individual if statement
Re: Simple number manipulation
Code: Select all
num := [ 1, 14]
Left := [[ 3, 23], [ 9, 90]]
Right := [[19, 60], [12, 22]]
Gosub, Show
Left::
Right::
%A_ThisHotkey%.Push(num := %A_ThisHotkey%.RemoveAt(1))
Show:
MsgBox, 64, Numbers, % num.1 " and " num.2
Return
Re: Simple number manipulation
Thanks v much, just two points then it's all complete
Point 1:
If we are at 3,23, in bold, and press left, we should get 9,90. At the moment, we get 3,23, as if each button has it's own sequence in memory, which is wrong. We only ever need the active numbers in memory, and everything preceeding that is irrelevant.
Point 2:
This seems to not work under an #IfWinactive condition?
Point 1:
Code: Select all
num := [ 1, 14]
Left := [[ 3, 23], [ 9, 90]]
Right := [[19, 60], [12, 22],[b][3,23][/b]]
Point 2:
This seems to not work under an #IfWinactive condition?
Re: Simple number manipulation
If you have a revised script using a directive, then post the revised script.
You have provided only partial descriptions of your need. Provide a complete description, and a complete example of it, from start to finish.
Another example:
You have provided only partial descriptions of your need. Provide a complete description, and a complete example of it, from start to finish.
Another example:
Code: Select all
set := [[1, 14], [3, 23], [9, 90], [19, 60], [12, 22]], n := 1
#IfWinActive ahk_exe notepad.exe
Left::
Right::
n := A_ThisHotkey = "Left" ? --n ? n : set.Count() : n++ - set.Count() ? n : 1
Send % set[n].1 ", " set[n].2 "`n"
Return
#IfWinActive
Last edited by mikeyww on 16 Sep 2021, 08:20, edited 1 time in total.
Re: Simple number manipulation
Thanks for the reply.
So the above will look more like
I just need the functionality, then I can manually add and modify the desired numbers I need.
Any time a button is pressed, IF it's within the chain for the pressed button, it would send the two numbers directly after it in it's own sequence.
Example - [3,23] could be in every single sequence (for left/right/up/down/enter/more buttons), but it being active at the same time the specific button is pressed is crucial to what the next number will be.
Code: Select all
num := [ 1, 14]
Left := [[ 3, 23], [ 9, 90]]
Right := [[19, 60], [12, 22]]
Code: Select all
num := [ 1, 14]
Left := [[ 3, 23], [ 9, 90]...]
Right := [[19, 60], [12, 22]...]
Up := [[ 8, 45], [ 9, 165]...]
Down := [[6, 51], [..., ...]...]
Enter:= [...]
...
Any time a button is pressed, IF it's within the chain for the pressed button, it would send the two numbers directly after it in it's own sequence.
Example - [3,23] could be in every single sequence (for left/right/up/down/enter/more buttons), but it being active at the same time the specific button is pressed is crucial to what the next number will be.
Last edited by blad4 on 16 Sep 2021, 08:41, edited 1 time in total.
Re: Simple number manipulation
Your script has multiple bugs. Simplify it until it works with something very simple. See documentation about auto-execute section and #If directives, which apply only to hotkeys & hotstrings. Unlabeled code following Return is unreachable and will not execute.
Your post provides no specific examples from start to finish. I will give up until that time.
Your post provides no specific examples from start to finish. I will give up until that time.
Re: Simple number manipulation
Hope this makes sense.. the logic is that we are just mapping custom sequences which interact with eachother, so you can see the routes to writing them out is impossible, as the aim is to be able to add and adjust buttons and combos
Code: Select all
num := [ 1, 14]
Left := [[ 3, 23], [ 9, 90], [3,23], [58,105]]
Right := [[19, 60], [12, 22], [3,23], [4,65]]
Assume start 1,14
L: 3,23
L: 9,90
L: 3,23
L: 58,105
L: 3,23
etc...
Another version
L: 3,23
L: 9,90
L: 3,23
R: 4,65
R: 19,60
R: 12,22
R: 3,23
R: 4,65
etc...
Another
L: 3,23
L: 9,90
L: 3,23
R: 4,65
R: 19,60
R: 12,22
R: 3,23
R: 4,65
L: NOTHING
R: 19,60
Another
R: 19,60
R: 12,22
R: 3,23
L: 58,105
...
Last edited by blad4 on 16 Sep 2021, 12:22, edited 1 time in total.
Re: Simple number manipulation
I am following most of the sequences.
QUESTION #1. What is the rule that should get from line 34 to line 35?
QUESTION #2. If line 34 were "L", what numbers would be used at that point?
QUESTION #1. What is the rule that should get from line 34 to line 35?
QUESTION #2. If line 34 were "L", what numbers would be used at that point?
Re: Simple number manipulation
QUESTION #1.
There are no rules per se, when referring to 'R' or 'L'. These are merely the buttons I choose to press
For line 34, num was [4,65], then I happened to press Left, yielding [3,23]
QUESTION #2
If Line 34 was from the L chain, it would have meant we pressed Left on Line 33, yielding:
Line 34:
There are no rules per se, when referring to 'R' or 'L'. These are merely the buttons I choose to press
For line 34, num was [4,65], then I happened to press Left, yielding [3,23]
QUESTION #2
If Line 34 was from the L chain, it would have meant we pressed Left on Line 33, yielding:
Line 34:
Code: Select all
L: 9,90
Re: Simple number manipulation
Seems like the transition from line 35 to 36 is what doesn’t make sense. Line 35 should have been the first instance of [3, 23], so jumping to [4, 65] from there does not follow the previous logic. Line 36 should be [12, 22].
Re: Simple number manipulation
Right (or Left)! I am hearing that there are no rules here. Since I am not seeing how to write a script that follows this exact pattern that has been outlined in the example, I will let others accomplish it!
- flyingDman
- Posts: 2791
- Joined: 29 Sep 2013, 19:01
Re: Simple number manipulation
Is this the idea?:
Code: Select all
Left := [[ 3, 23], [ 9, 90], [3,23], [58,105]]
Right := [[19, 60], [12, 22], [3,23], [4,65]]
cnt := 0
left::
cnt := cnt = 4 ? 1 : ++cnt
tooltip, % left[cnt][1] " " left[cnt][2]
return
right::
cnt := cnt = 4 ? 1 : ++cnt
tooltip, % right[cnt][1] " " right[cnt][2]
return
14.3 & 1.3.7
Re: Simple number manipulation
Yes, I think there are definite rules that flyingDman captured. It’s just that there was a mistake in the examples that violated the rules.
Re: Simple number manipulation
I just checked adding more to the sequence on flyingDman's and they did not get recognised
But that is the exact idea, yes. Now we just need to make it responsive to user edits nad modifications.
Also, logically, if left is pressed at 12,22 for instance, it should not call any new numbers. The only time it should, in the Right chain, is at 3,23, because there is (2x) [3,23] present in the Left chain. Thus the logic is obviously we get 9,90 (not 58,105 even though that comes after the second [3,23].
But that is the exact idea, yes. Now we just need to make it responsive to user edits nad modifications.
Also, logically, if left is pressed at 12,22 for instance, it should not call any new numbers. The only time it should, in the Right chain, is at 3,23, because there is (2x) [3,23] present in the Left chain. Thus the logic is obviously we get 9,90 (not 58,105 even though that comes after the second [3,23].
- flyingDman
- Posts: 2791
- Joined: 29 Sep 2013, 19:01
Re: Simple number manipulation
The lines:
should be replaced with
and
Code: Select all
cnt := cnt = 4 ? 1 : ++cnt
Code: Select all
cnt := cnt = left.count() ? 1 : ++cnt
Code: Select all
cnt := cnt = right.count() ? 1 : ++cnt
14.3 & 1.3.7
Re: Simple number manipulation
Thank you, this is quite functional, but still relies on us moving ahead in the sequence globally by one.
Take for example, when just pressing right 3 times, then left 1 time.
We land at 3,23 before pressing left. Desired result it 9,90, but instead is yielding 58,105.
Assume we press left 1 time, getting 3,23 then right 1 time. At the moment it gets 12,22, what we should get is 4,65 (the set immediately after 3,23)
Take for example, when just pressing right 3 times, then left 1 time.
Code: Select all
Left := [[ 3, 23], [ 9, 90], [3,23], [58,105], [89,11]]
Right := [[19, 60], [12, 22], [3,23], [4,65], [89,11]]
Code: Select all
Left := [[ 3, 23], [ 9, 90], [3,23], [58,105], [89,11]]
Right := [[19, 60], [12, 22], [3,23], [4,65], [89,11]]
Re: Simple number manipulation
This is 100% correct regarding the error, but it should read like a 'null' response, because pressing left at 4,65 should not have a consequence. Just changed it now
Re: Simple number manipulation so, how did it get there
What you’re saying it actually does is exactly what I expected it to do. I don’t see the logic in what you are now describing. You said before there are no rules. That cannot be the case since you have an expected outcome. You are going to need to try to articulate the rules to land on what you are describing.blad4 wrote: ↑16 Sep 2021, 12:13Thank you, this is quite functional, but still relies on us moving ahead in the sequence globally by one.
Take for example, when just pressing right 3 times, then left 1 time.
We land at 3,23 before pressing left. Desired result it 9,90, but instead is yielding 58,105.Code: Select all
Left := [[ 3, 23], [ 9, 90], [3,23], [58,105], [89,11]] Right := [[19, 60], [12, 22], [3,23], [4,65], [89,11]]
Assume we press left 1 time, getting 3,23 then right 1 time. At the moment it gets 12,22, what we should get is 4,65 (the set immediately after 3,23)Code: Select all
Left := [[ 3, 23], [ 9, 90], [3,23], [58,105], [89,11]] Right := [[19, 60], [12, 22], [3,23], [4,65], [89,11]]
The second example above especially does not make sense to me. After pressing left one time, it should be at 3, 23 because it’s at the first instance of 3, 23 in the top sequence. To get 4, 65 after pressing right would suggest that it somehow was at the second instance of 3, 23 in the top sequence of numbers before right was pressed. If so, how was it supposed to have gotten there?
Re: Simple number manipulation so, how did it get there
Thanks Boiler. There should actually be independence of the sequences. Let me make some drawings and add to this post to further elaborate, and I'm going to completely rejig the sense of forward direction within the sequences for now, for utmost simplicity, as I can now see where my rules are not making sense.boiler wrote: ↑16 Sep 2021, 14:40What you’re saying it actually does is exactly what I expected it to do. I don’t see the logic in what you are now describing. You said before there are no rules. That cannot be the case since you have an expected outcome. You are going to need to try to articulate the rules to land on what you are describing.blad4 wrote: ↑16 Sep 2021, 12:13Thank you, this is quite functional, but still relies on us moving ahead in the sequence globally by one.
Take for example, when just pressing right 3 times, then left 1 time.
We land at 3,23 before pressing left. Desired result it 9,90, but instead is yielding 58,105.Code: Select all
Left := [[ 3, 23], [ 9, 90], [3,23], [58,105], [89,11]] Right := [[19, 60], [12, 22], [3,23], [4,65], [89,11]]
Assume we press left 1 time, getting 3,23 then right 1 time. At the moment it gets 12,22, what we should get is 4,65 (the set immediately after 3,23)Code: Select all
Left := [[ 3, 23], [ 9, 90], [3,23], [58,105], [89,11]] Right := [[19, 60], [12, 22], [3,23], [4,65], [89,11]]
The second example above especially does not make sense to me. After pressing left one time, it should be at 3, 23 because it’s at the first instance of 3, 23 in the top sequence. To get 4, 65 after pressing right would suggest that it somehow was at the second instance of 3, 23 in the top sequence of numbers before right was pressed. If so, how was it supposed to have gotten there?
Essentially, without any duplicate sets within one sequence, we do not need to count where we are in the cycle. Only thing in memory we need is the imminent set to be changed.
- Attachments
-
- ahk1.png (20.98 KiB) Viewed 1248 times
Re: Simple number manipulation
ur explanations are all over the place
this thing
contradicts this other thing
and this
shows yet another wrong sequence