MetaCmnds.txt 'Sections '-------- ' Meta Commands overview - used in Hextor_3.bsx onwards ' Ultrasonic behaviour rules ' Sequences ' Using BOS commands in sequences ' Meta Commands overview - used in MultiProgSx0 ' Ultrasonic behaviour rules ' Sequences ' Meta Commands overview - used in MultiProgSx1 ' Ultrasonic behaviour rules ' Sequences '++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ' 'Meta Commands overview - used in Hextor_3.bsx onwards '----------------------------------------------------- ' 'Ultrasonic behaviour rules ' a - Action, use in ultrasonic behaviour rules ' if selected do the sequence indicated. ' X - if action ="X" then ignore that result. ' Yawn indicates how bored the robot is with a rule outcome. ' Y - Yawn, use in ultrasonic behaviour rules ' if selected increment the indicated yawn variable. ' y - yawnreset, use in ultrasonic behaviour rules ' if selected resets the indicated yawn variable. 'Sequences ' z - terminator for sequences ' a - Action, used in sequences, acts as a GOTO ' eg "FBRLa",word wiggle,"FROP.. ' jumps to the sequence 'wiggle' ' and ignores the rest of the original sequence, ' use for endless sequences or for joining sequences ' eg "FBRLa",word wiggle ' jumps to the sequence 'wiggle' instead of ending. ' eg ' wiggle DATA "FBRLa",word wiggle ' will do wiggle forever (or until battery goes flat) ' i - include, use in sequences, acts as a GOSUB ' eg "FBRLi",word wiggle,"FROP.. ' does the sequence 'wiggle' and then returns. ' x - eXecute a Basic subroutine, used in sequences ' "x",, ' eg "FBRLx",xleds,n,"FROP... ' where xleds is the name of a constant used to ' control a Branch command in the subroutine Xecute ' and 'n' is the parameter for the routine. ' see Hextor26.BSx ' e - Evaluate, do a test in Basic and branch on the result ' "e",,,,word ' eg "FBRLe",ebump,%01,"=",word avoid,"FFBB... ' where ebump is the name of a constant used to ' control a Branch command in the subroutine doeval. ' In this case if the test was true then the sequence ' avoid would be GOTOed (as with a) ' see Hextor27.BSx ' 'Using BOS commands in sequences ' The ascii BOS commands with decimal arguments, ' ie hwvsrmlng when used from a terminal are sent as ' but when used in a ' sequence are written as ' DATA ... ",, ' without the CR, ie the decimal value is stored by DATA as ' a byte, this made it easier to read the sequence. '-------------------------------------------------------------- ' 'Meta Commands overview - used in MultiProgSx0 '--------------------------------------------- 'Ultrasonic behaviour rules '"A" if the action is A then run the Activity Sequencer with ' the activity A_null. '"a" if selected by the test then triggers the Action sequence ' first parameter is prognumber for the Activity sequencer ' second is Activity '"X" if action ="X" then ignore that result. ' 'Yawn '---- ' The yawn rules are special in that when an outcome of ' other rules is activated scanning through the rule set is ' terminated, however the "Y" rule only tests whether the ' next rule should be used, and the "y" rule only resets ' the "yawn" variable before the rule following it is used. ' The first parameter byte for "Y" or "y" is the index to ' the yawn variable, 0=>usyawn0, 1=>usyawn1. ' The second parameter byte is the threshold '"Y" if selected by the test increments 'usyawnX'. ' If 'usyawnX'> threshold then skip the following rule. '"y" if selected then resets 'usyawnX' to 0 'so select same parameters for rule to be skipped for both Y, y ' 'Rules - 'DATA direction,range,do if >,do if <,activity program,activity 'If the rule doesn't contain "a" then no sequence can be 'activated by it so any value could be used for the pointer 'value. 'Sequences ' Note the addition of "u" and "I". ' "z" terminator for sequences ' "a", jump to sequence 'name' ' "i", includes sequence 'name' as a subroutine ' "x",, execute Basic subroutine xname ' "e",,,}> do a Basic test & branch ' "u", do USrulename in Ultrasonic behaviour program ' "I", change LED state ' '-------------------------------------------------------------- ' 'Meta Commands overview - used in MultiProgSx1 '--------------------------------------------- 'Ultrasonic behaviour rules ' New ' --- ' Meta command "a" changed to "I" for include and Prog/Option ' ' Meta command "A" eliminated - use I,x,0 instead ' ' Explanation that meta command 'I' can allow a US behaviour to ' transfer control to another behaviour. ' Introduction of a meta command 'J' to allow a jump to another ' program without any return address being put on the stack. ' "I" if selected by the test then includes a Prog/Option, ' first parameter is prognumber, second is Option. ' Return address is stacked. ' "I" can be used to run any program + option including ' US behaviours, however yawn variables values will be ' inherited. ' "X" if action ="X" then ignore that result. ' "J" if action ="J" then jump to new program, no stack action ' first parameter is prognumber, second is option ' so we can even run another US behaviour. ' If the Option is 0 then the jumped to Prog will be forced ' to check the stack and so acts as RETURN. ' Yawn ' ---- ' The yawn rules are special in that when an outcome of ' other rules is activated scanning through the rule set is ' terminated, however the "Y" rule only tests whether the ' next rule should be used, and the "y" rule only resets ' the "yawn" variable before the rule following it is used. ' The first parameter byte for "Y" or "y" is the index to ' the yawn variable, 0=>usyawn0, 1=>usyawn1. ' The second parameter byte is the threshold ' "Y" if selected by the test increments 'usyawnX'. ' If 'usyawnX'> threshold then skip the following rule. ' "y" if selected then resets 'usyawnX' to 0 ' so select same parameters for rule to be skipped for both Y, y ' 'Sequences 'Sequences ' z - terminator for sequences ' J - Jump to another Program, where option is selected ' from Program's name table ' "J",,