Help with my first automation script

Post Reply
Posts: 1
Joined: Fri Oct 25, 2019 9:02 am

Help with my first automation script

Post by IBurnTeddyBears »

wasn't supposed to post yet.
The movement would be interupted at any point by a sequence on detection of an enemy, would kill the enemy, and then collect it's things, and then start off in a direction again.
How did space post that already. Anyways here's the script.

-- Found prey is intentioned to function as a toggle switch, with the value being 0 following the search pattern protocol, and value 1 following the found prey protocol
found_prey = {}
-- Change direction is a momentary switch, that interupts movement along one axis when collision is detected, moves me down one row, and then changes the direction in
-- which i travel until colision is detected again, in which it sends me south once more, and repeats
change_directon = {}

-- Triggers to detect prey, then switch on the found prey protocol

tempTrigger("fat raccoon", table.insert (found_prey,1))
tempTrigger("fat piglet", table.insert (found_prey,1))
tempTrigger("quiet doe", table.insert (found_prey,1))

--Detects failed movement in the east/west axis, sends me one south, and initiates a switch in directions
tempTrigger("You can't go that way!", send ("s"))
tempTrigger("you can't go that way!", table.insert (change_direction,1))
tempTimer(1, table.insert (change_direction,0))

-- The search pattern, heads west until colision is detected, above trigger sends me one south, and then heads east until collision is detected, to repeat until prey is located
if found_prey == 0
repeat send ("w")
until change_direction == 1
repeat send ("e")
until change_direction == 1
until found_prey == 1

-- the found prey protocol, the killing and collecting from prey, and reset of prey detection trigger,
if found_prey == 1
then send ("do kill pig, kill raccoon, kill doe,")
tempTrigger("falls to the ground", tempTimer(3, send ("kill")))
tempTrigger("has died", send ("do skin corpse, put pelt in panniers, put pelt in wain, put pelt in wagon, attach pelt to string, get all from corpse into panniers, get all from corpse into wagon, get all from corpse into pack, get all from corpse, eat corpse"))
tempTimer(2, table.insert (found_prey,0))

Post Reply