GUI Syntax Error

So I am trying to make variable BlueLeft equal 1 if a certain part of the screen is pressed during driver control so that in autonomous, I can see if BlueLeft = 1 so that it would run the BlueLeft auton. I tried to just make the robot move to see if I was doing it correctly, and it gave me a syntax error. In the pre-auton section, I set both BlueLeft and RedRight to 0. If anybody could help me understand why “if BlueLeft = 1: then do this” won’t work then I would appreciate it immensely.
Code:

    # GUI Functions
    if brain.screen.pressing():
        brain.screen.draw_circle(brain.screen.x_position(),brain.screen.y_position(),16)
        brain.screen.render()
        sys.sleep(1)
        if brain.screen.y_position() > 10 and brain.screen.y_position() < 110 and brain.screen.x_position() > 30 and brain.screen.x_position < 130:
            BlueLeft = 1
        elif brain.screen.y_position() > 120 and brain.screen.y_position < 220 and brain.screen.x_position() > 360 and brain.screen.y_position < 460:
            RedRight = 1
        
    if BlueLeft = 1:
        TrayMotor.spin(DirectionType.FWD,80,VelocityUnits.PCT)

For reference, I am programming this in Python using RMS

Ah, this one’s a classic. The short story is that you need to use == to test for equality, and = to force equality. So the line should be “if BlueLeft == 1:” instead.

3 Likes

Wow, I feel very dumb lmao.
One more question, I tried to display the state of BluePeft on my controller by saying con.screen.print_(BluePeft). It didn’t seem to work, how would I go about doing this?

Gotta love gooey syntax errors

First I’d try printing BlueLeft instead of BluePeft. If that isn’t the problem, I’d have to see more code.

Yeah sorry I mean BlueLeft, apparently my phone decided it want to auto correct, could I dm you my code?

I mean it compiles and downloads just fine, but it does not show anything once the program has actually started up.

The easiest way is probably to just set your project to public with the options gear at the top right, then paste the link. No worries about formatting that way.