Jump to content


michaelcampbell229's Content

There have been 2 items by michaelcampbell229 (Search limited from 18-September 20)


By content type

See this member's

Sort by                Order  

#268236 Controlling Turtle with local key-pressed events

Posted by michaelcampbell229 on 13 July 2017 - 04:02 AM in Ask a Pro

View PostKingofGamesYami, on 12 July 2017 - 01:33 PM, said:

Pressing 'm' does print "YES". However, let's take a look at the sequence of events

-screen is cleared
-cursor set
-"controlled" written
-"m" is pulled as an event
-"YES" is printed
-screen is cleared
-cursor set
-"controlled written"
-waits for another event.
Thanks for your response, so it is displaying yes but it is then instantly cleared and "controlled" is then displayed again. Ok thanks, I'll try modify the code so it doesn't look like that, any suggestions that would still provide the functionality that I am trying to achieve?



#268210 Controlling Turtle with local key-pressed events

Posted by michaelcampbell229 on 12 July 2017 - 06:57 AM in Ask a Pro

So I have to two scripts. One runs on a Advanced Wireless Pocket Computer and the other on a Advanced Wireless Mining Turtle.
This script runs on the turtle controls movement such as forwards, up, down, turn left, turn right, backwards, break block, and place blocks.
ComputerCode
and this code runs on the turtle. When the turtle receives a message, corresponding to the message sent dependent on a key pressed, it then moves the turtle. I haven't written the code that will actually make the turtle move (based on which options is selected) yet that that shouldn't be too hard.
TurtleCode

So, the turtle will move based on which key is pressed when the screen is showing Height, Forwards, and Back (as expected and planned) as/when variable x == 1. When the "k" key is pressed the screen clears and shows the "Controlled" screen (which that should show when the "k" key is pressed) (and if pressed again will go back to the previous screen/message) but when another key is pressed such as the programmed m key nothing is happening, should pressing the m key not print "YES" ? (and if it is changed to another key, such as l, the same result) Originally i thought that it was because there are two local events but then when on the Controlled screen pressing the k key wouldn't do anything correct?

The idea is when its in the first mode (Height ect) the user can manually control the turtle, when they press k (probably should make it k and something else, but that is easy) the robot goes into "Programmed/Controlled" mode, the user then selects an option such as: option a: dig 16x16x1 meaning that rather than the user having to manually control the robot to dig out area they put it in programmed mode and off it goes based on controls stored/programed on the turtle; but I have hit this wall and I cant progress until this bit is fixed.

Something like this would replace the part that currently says "YES": (this includes the option a, option b, and option c bit) (this bit of code is not tested just an idea as I haven't been able to get past this bit so ignore any code errors in this part)
CodeTheory - read after