# May be used for spider *or* coin_beast! state "mainloop": # Main AI loop if() then: key: up b continue if: key: isdown u coll: all yes ;; (+)- + then: # We're still on the ground, wait for our jump to start... if: coll: any no ;; (+)- + then: # If we're jumping, then do nothing... key: up u # Sometimes, jump! if: chance: 20% any: all: coll: all yes ;; ( ) . . + - + coll: any no ;; ( ) . - + - . . coll: all no ;; \*/*\*/*\*/* ;; + - + - + - ;; /*\*/*\*/*\* ;; ( ) . . . . all: coll: all yes ;; + ;; / ;; ( ) . . + coll: any no ;; ( ) . - + - . coll: all no ;; \*/*\*/* ;; + - + - ;; /*\*/*\* ;; ( ) . . . all: coll: all yes ;; ( ) . . . + - + coll: any no ;; ( ) . - + - + - . . coll: all no ;; \*/*\*/*\*/*\*/* ;; + - + - + - + - ;; /*\*/*\*/*\*/*\* ;; ( ) . . . . . all: coll: all yes ;; + ;; / ;; ( ) . . . + coll: any no ;; ( ) . - + - + - . coll: all no ;; \*/*\*/*\*/* ;; + - + - + - ;; /*\*/*\*/*\* ;; ( ) . . . . then: key: up f key: down u # Sometimes, crawl! if: chance: 25% any: all: coll: any yes # Only crawl somewhere we couldn't just walk ;; \*/* ;; + - ;; ;; ( ) . coll: all yes ;; ( ) + - + coll: all no ;; \*/* ;; (.) . all: coll: any yes # Only crawl somewhere we couldn't just walk ;; \*/* ;; + - ;; \*/* ;; ( ) . + - ;; \* coll: all yes ;; ( ) + ;; \ ;; + coll: all no ;; \*/* ;; (.) . - ;; * then: key: up f key: down d set myvar("crawl_time"): 0 goto: "mainloop_crawl" if: # Small chance to spontaneously turn around... # Can help get un-stuck from certain situations # NOTE: multiple "chance" conditions can be used to achieve sub-1% chance... chance: 1% chance: 20% then: key: up f key: down b delay: 4 # Always walk straight ahead if we can if: any: all: coll: all yes ;; ( ) + - + coll: all no ;; \*/* ;; + - ;; /*\* ;; ( ) all: coll: all yes ;; + ;; / ;; ( ) . + coll: all no ;; \*/* ;; + - ;; /*\* ;; ( ) all: coll: all yes ;; + ;; / ;; ( ) + all: coll: all yes ;; + ;; \ ;; + ;; ;; ( ) + all: coll: all yes ;; + - + ;; ;; + ;; ;; ( ) + all: coll: all yes ;; + ;; / ;; + ;; ;; ( ) + coll: all no ;; ;; *\*/* ;; - + - . ;; \* ;; . ;; ;; ( ) . all: coll: all yes ;; ( ) + ;; \ ;; + coll: all no ;; \*/* ;; + - ;; /*\*/* ;; ( ) - + - ;; */*\* then: key: down f # Turn around if we're stuck if() then: key: up f key: down b delay: 6 state "mainloop_crawl": if() then: key: up b inc myvar("crawl_time") continue # Sometimes, stand! if: expr: > myvar("crawl_time") 7 # Don't just stand up right after crouching... chance: 25% coll: all no ;; *\*/* ;; - + - ;; */*\* ;; ( ) then: key: up f key: up d goto: "mainloop" # Always walk straight ahead if we can if: any: all: coll: all yes ;; + ;; / ;; ( ) + coll: all no ;; \* ;; ( ) all: coll: all yes ;; ( ) + - + coll: all no ;; \*/* ;; (.) . all: coll: all yes ;; ( ) + ;; \ ;; + coll: all no ;; \*/* ;; (.) . - ;; * then: key: down f # Stand up if we're stuck if: chance: 70% coll: all no ;; *\*/* ;; - + - ;; */*\* ;; ( ) then: key: up f key: up d goto: "mainloop" # Turn around if we're stuck if() then: key: up f key: down b delay: 6