.Tin and .Tout

From WikiManual
(Redirected from .tout1)
Jump to: navigation, search

This refers to the .tin1 - .tin10 and .tout1 - .tout10 TrefVars locations. The number stored at tout1, tout2 or another tout can be read by any robot tied to the bot, with the value arriving at tin1, tin2 or another tin respectively. These work just like any other TrefVar.

Example of how .tinX and .toutX can be used:

'Defines two custom variables to be used later, must be placed at top
def targetx 50
def targety 51

'Specifies tie to be read, uses the newest one in this example, change this if you want to pick were it is read from
*.tiepres .readtie store

'Check for target and store position to be read
*.refeye *.myeye !=
*.eye5 0 != and
*.refxpos .tout1 store
*.refypos .tout2 store

'Check for target position every ten cycles
*.robage 10 mod 0 =  'Every ten cycles this will return true
*.tin1 .targetx store
*.tin2 .targety store

This will pass target position from one bot to another so the tied bots could help one another out.


Robot DNA