xabbo-scripts/Scripts/Enter-One-Way-Door #1.csx
Administrator 7a548130a3 Move all scripts into Scripts/ subfolder
Keeps the repo root clean - only README.md visible on landing page.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-16 09:49:37 +01:00

59 lines
1.4 KiB
C#

/// @group Bots
public class TileAction
{
private readonly Action MainAction;
private readonly Action ElseAction;
private readonly Func<bool> Condition;
public TileAction(Action mainAction) => MainAction = mainAction;
public TileAction(Action mainAction, Action elseAction, Func<bool> condition) : this(mainAction)
{
ElseAction = elseAction;
Condition = condition;
}
public void Execute()
{
if (Condition == null || Condition())
{
MainAction();
}
else
{
ElseAction();
}
}
}
public Point RealPos => (Self.CurrentUpdate.MovingTo ?? Self.Location).XY;
Dictionary<Point, TileAction> Actions = new()
{
// HIER DEINE ACTIONS
{ ( 24, 15), new (() => Send(Out["EnterOneWayDoor"],2147418205)) },
{ ( 24, 16), new (() => Send(Out["EnterOneWayDoor"],2147418204)) },
{ ( 25, 16), new (() => Send(Out["EnterOneWayDoor"],2147418203)) },
{ ( 25, 17), new (() => Send(Out["EnterOneWayDoor"],2147418547)) },
{ ( 26, 19), new (() => Send(Out["EnterOneWayDoor"],2147418490)) },
{ ( 25, 19), new (() => Send(Out["EnterOneWayDoor"],2147418211)) },
{ ( 25, 20), new (() => Send(Out["EnterOneWayDoor"],2147418212)) },
{ ( 24, 20), new (() => Send(Out["EnterOneWayDoor"],2147418551)) },
};
while (Run)
{
try
{
if (Actions.TryGetValue(RealPos, out var result))
{
result.Execute();
}
}
catch { }
Delay(100);
}