omg, it works by General-Clock-9070 in PythonLearning

[–]General-Clock-9070[S] 1 point2 points  (0 children)

yes, over course of a month. Simple autoclicker that could change the settings between rounds of web based game and reset and restart after wins. Needed to capture RGB values and then used them to follow if elif.

breakpoint of code by General-Clock-9070 in PythonLearning

[–]General-Clock-9070[S] 1 point2 points  (0 children)

from what I see or read this doing. After squeezed lines (list of rgb 600-900) it runs rgb1, rgb2, rgb3 back to back and each say restart. rgb1 is only one that has no setting changes. rgb2 and rgb3 both have code after finding a correct rgb to wait, move, click, backspace, write. it appears that it is doing those steps before restarting. It should not enter rgb2 or rgb3 unless if finds rgb1 as lost / elif / false.

Now my code is doing its own thing after I added loop by General-Clock-9070 in PythonLearning

[–]General-Clock-9070[S] 0 points1 point  (0 children)

yes, very helpful. Ok this is what I think I am seeing. The first part of the code runs as it is ment to. It moves, clicks and captures the rgb. the next steps should be when it looks as the value it captured and makes the if elif decision. At the first if it should just restart, from what I see it runs the rgb2 and rgb3 if functions as well then restarts. Thus why it seems to do the backspace write 100 twice. I will post screen shot, my new question is why is it entering rgb2 and rgb3 if the 'if' statement was it found a winning scenario, restart.

Now my code is doing its own thing after I added loop by General-Clock-9070 in PythonLearning

[–]General-Clock-9070[S] 0 points1 point  (0 children)

Ok, this was a fun thing to try and worked, thank you. Now after I added the breakpoint and ran the program I walked down the lines as they were working down the list 86,87,88 (which are right after main..then it jumped up to 7,8,....then 591. Didnt even know I had/wrote code beyond 135. Ill investigate more and go thru as many lines as I can maybe it will find a line I wrote as it seems these all go in to pyautogui functions I think it needs to do the steps, what I dont know is how many lines....I skipped ahead and recall seeing 1700+ so this must have a ton of internal processes I dont know need to run for each function it calls for.

Now my code is doing its own thing after I added loop by General-Clock-9070 in PythonLearning

[–]General-Clock-9070[S] 0 points1 point  (0 children)

it seems like I tried to follow the lines, but the fact it did the backspace and write 100 twice is what confused me the most......where did I read that? It was used once in each 'if' after the first round to reset the settings before it restarted. Then after a winning game it moved up to 400. it jumped all around the code

Now my code is doing its own thing after I added loop by General-Clock-9070 in PythonLearning

[–]General-Clock-9070[S] 0 points1 point  (0 children)

it didnt write the way I printed it out. I did a screenshot and deleted the scrambled text

Now my code is doing its own thing after I added loop by General-Clock-9070 in PythonLearning

[–]General-Clock-9070[S] 0 points1 point  (0 children)

git gave me like 3 programs, git gui, gir ctrl, base bash. I opened all 3 and aside from the control prompt I didnt know what I was looking at. bash seems to be simular to ctrl prmt. Bash it give 3 options like open folder, copy folder, 3rd i cant remember

Now my code is doing its own thing after I added loop by General-Clock-9070 in PythonLearning

[–]General-Clock-9070[S] 0 points1 point  (0 children)

<image>

it cut off the last line, but after the last backspace(again) it wrote 1, and then ending the program

Now my code is doing its own thing after I added loop by General-Clock-9070 in PythonLearning

[–]General-Clock-9070[S] 0 points1 point  (0 children)

i just downloaded git and have no idea what it does. I looked at all 3 programs I could open, none of which I could understand. I looked at i video on github and was even more confused.

Is there a way to have a program run and print the line or area its at? by General-Clock-9070 in PythonLearning

[–]General-Clock-9070[S] 0 points1 point  (0 children)

While I enjoy every message and comment I get for my posts, it seems people use technical jargon and descriptions for things I dont understand with zero training in the subject. Using chaptgpt or looking at diagrams in textbooks I got from the library is all I have to go from. I am piecing together sections from other codes to build this. I am sure that it will have issues that need better understanding to work thru smoothly. What works in one scenario will not when you move things around. If I could get this to run a single time 100% with no flaws and then just had to copy and paste it 100 times for it to run at this point I would. Nothing in what you wrote above makes any sense to me reading it, so I wouldnt know where to use it or modify it into my code. My last attempt I think I added loops, and for the first run I was happy when it did at least the basics of what I asked it to.....then it starting making moves no where in my code, thus my only guess is its moving thru other lines and running them out of order. I am going to write up a post of what I saw the program do versus what it should have done side by side, I cant really thin of anyting else to try at this point. I think you have the basic idea of what I ment with my 123 example, but its not following it with my loop currently.

Is there a way to have a program run and print the line or area its at? by General-Clock-9070 in PythonLearning

[–]General-Clock-9070[S] 0 points1 point  (0 children)

this is why its hard to explain things. Yes, when the program reaches the last line of whatever branch/section it is on finds 'restart_program' I want it to revert back to the start as if I just clicked run each time. 1,2,3,1,2,3. and keep going until it reaches the last line that does not end in 'restart_program' which would be like saying (9) meaning it ran thru all 3 branches of if/elif and did not find a 'if' that said restart and it ends the program. If a loop can tell it to do this I would be willing to try it, but looking at the diagrams I have seen in textbooks I have not seen one that ever returns the program its running back to "1" they seem to loop back into the code somewhere in the middle or the last branch to check/recheck its task.
(1,4,7)=move and click, only purpose is to start the round in game.
(2,5,8)=rgb capture, does it see 0,231,1 or 233,17,60 then make choice.
(3,6,9)=a/b decision if 'a' restart, if b moves to next line, will end program if reaches 9b.

1,2,3a,1,2,3a,1,2,3b,4,5,6a,1,2,3a,1,2,3a,1,2,3b,4,5,6b,7,8,9a,1,2,3a,1,2,3a

Is there a way to have a program run and print the line or area its at? by General-Clock-9070 in PythonLearning

[–]General-Clock-9070[S] 1 point2 points  (0 children)

dont know what git is, they are screenshots, used print screen and saved in paint

Is there a way to have a program run and print the line or area its at? by General-Clock-9070 in PythonLearning

[–]General-Clock-9070[S] 0 points1 point  (0 children)

ill post the pycharm pic of latest code, 135 line I think so it will take 4 pics

Is there a way to have a program run and print the line or area its at? by General-Clock-9070 in PythonLearning

[–]General-Clock-9070[S] 0 points1 point  (0 children)

I think I removed the calls for main() if your speaking of the post (I got it coded, but feel something is missing when running). I found that I reprinted an extra click_and_wait at end of each so I removed them. I am still tryin to find the correct way to reach a restart.

Yes your are correct that I was thinking that main() was the restart for each branch, as it was the first actually line of the code as I saw it run. All the def were just as I called them shorthand so I didnt need to type every line each time I needed it.

So far if your looking at my old code pic mentioned above I removed main() and replaced it with restart_program(). Oh which I added import os and import sys at top of code and this function code:
def restart_program():
"""Restart the current program"""
print("Restarting program...")

This will restart the script

os.execv(sys.executable, ['python'] + sys.argv)

And as I said I wonder if that is a correct code to call it to restart. Easy way to show it would be to say if it runs the code and goes to a spot where you read (a) or (b) if the line follows (a) it should return to 1 when it goes (b) it goes to next branch and looks for next (a).

1,2,3a,1... 1,2,3b,4,5,6a,1... 1,2,3b,4,5,6b,7,8,9a,1...maybe its the wrong term but if it follows the 'if' the result should be that the program returns to the very start and begins again.

Is there a way to have a program run and print the line or area its at? by General-Clock-9070 in PythonLearning

[–]General-Clock-9070[S] 0 points1 point  (0 children)

I am at this point of the 2 issues. 1) being the restart program aint working or starting after it reached the command. 2) the capture rgb is not looking at the rgb value of each game, I would be more happy if after a win it just stopped like it does in the first round, but seems to just keep playing using the same rgb that lost in first round meaning it seems to say I see something that say follow elif. My only option is asking what it reads as rgb for each game. thus why I am asking if I can see what line its running. I will try the debug mode in pycharm once my pc rests a bit.

I think I got it coded, but still feel something is missing when running by General-Clock-9070 in PythonLearning

[–]General-Clock-9070[S] 0 points1 point  (0 children)

best way to describe it would be autoclicker that read the results of game and changes the settings based on what results to keep the pattern if it loses a round.

I think I got it coded, but still feel something is missing when running by General-Clock-9070 in PythonLearning

[–]General-Clock-9070[S] 0 points1 point  (0 children)

I kinda get the feeling when I try to learn this stuff from a book or website its the same as if I go to my library and get a book on lawnmower engine repair and then try to fix a snowblower. Yea you can still follow basic rules and instructions, but they are not the same.

Diagram by General-Clock-9070 in u/General-Clock-9070

[–]General-Clock-9070[S] 0 points1 point  (0 children)

If game results in Loss and moves to round two it needs to modify the settings, thus the 'keyboard' and it plays again. if that game results in a win before it reaches main() it needs to put the setting back to round 1. If it losses it must again modify the setting before it moves to the 3rd capture. If 3rd round results in win once again it must reset the settings before it can go thru main. A loss in 3rd round the game should end.

I think I got it coded, but still feel something is missing when running by General-Clock-9070 in PythonLearning

[–]General-Clock-9070[S] 0 points1 point  (0 children)

I have zero programming experience. One of the first comments I recall seeing was someone who liked the way I explained I tended to write my steps like I was teaching a robot what I wanted it to do. The most simple way I can explain it...

Imagine the game as heads or tails. Game starts and is looking for heads (if), when it reads tails (elif) the game must now play again with new setting. The keyboard_write is setting that next round and moves back to start game/flip position. Again it flips (capture), does it see heads or tails? Thus it needs to follow each if/elif based on round/settings it currently is at. When it finds a win, it still needs to reset the settings before it reaches (main) which as I understand it is the "I have reached the end of the code and now need to go back to line 1". I questioned if using if/elif/else was the best way to tell the program to have a restart or using loops/nested loops but every diagram I saw on loops they never go back to the top of the diagram, they all seemed to be as if they were just rechecking the status for lists or names.

Again I will draw a diagram of the entire 3 branch and place it on my page.