How make compass?

I’ve made two broken scripts and I need your help.
variables

{
	global:
		20: directionstring
}

actions
{
	while(Horizontal Facing Angle Of(Host Player) < -44.75 || Horizontal Facing Angle Of(Host Player) > -134.25);
		Global.directionstring = Custom String("North");
		Wait(0.250, Ignore Condition);
	End;
	while(Horizontal Facing Angle Of(Host Player) < -134.25 || Horizontal Facing Angle Of(Host Player) > -179 || Horizontal Facing Angle Of(Host Player) < 179 || Horizontal Facing Angle Of(Host Player) > 134.25);
		Global.directionstring = Custom String("East");
		Wait(0.250, Ignore Condition);
	End;
	while(Horizontal Facing Angle Of(Host Player) < 134.25 || Horizontal Facing Angle Of(Host Player) > 44.75);
		Global.directionstring = Custom String("South");
		Wait(0.250, Ignore Condition);
	End;
	while(Horizontal Facing Angle Of(Host Player) < 44.75 || Horizontal Facing Angle Of(Host Player) > -44.75);
		Global.directionstring = Custom String("West");
		Wait(0.250, Ignore Condition);
	End;
	
}
variables
{
	global:
		20: directionstring
}

rule("Rule 14")
{
	event
	{
		Ongoing - Global;
	}

	actions
	{
		If(Horizontal Facing Angle Of(Host Player) <= -44.770 || Horizontal Facing Angle Of(Host Player) >= -134.590);
			Global.directionstring = Custom String("Север");
		End;
		If(Horizontal Facing Angle Of(Host Player) <= -134.590 || Horizontal Facing Angle Of(Host Player) >= 134.810);
			Global.directionstring = Custom String("Восток");
		End;
		disabled If(Horizontal Facing Angle Of(Host Player) <= 134.810 || Horizontal Facing Angle Of(Host Player) >= 44.360);
		disabled Global.directionstring = Custom String("Юг");
		disabled End;
		disabled If(Horizontal Facing Angle Of(Host Player) <= 44.360 || Horizontal Facing Angle Of(Host Player) >= -44.770);
		disabled Global.directionstring = Custom String("Запад");
		disabled End;
		Wait(0.250, Ignore Condition);
		Loop;
	}
}

I’ve been struggling with this problem for two days, and yes, I’ll warn you in advance, I’m not that good at the workshop.

as you may have noticed after determining the east side, disabled is going on, I am aware of this and once again you should not write about it, anyway, if you enable these actions, the script will not work anyway

variables
{
	global:
		20: directionstring
}

actions
{
	If(Absolute Value(Horizontal Facing Angle Of(Host Player)) >= 135);
		Global.directionstring = Custom String("North");
	Else If(Min(45, Horizontal Facing Angle Of(Host Player)) == Max(-45, Horizontal Facing Angle Of(Host Player)));
		Global.directionstring = Custom String("South");
	Else If(Horizontal Facing Angle Of(Host Player) > 45);
		Global.directionstring = Custom String("East");
	Else If(Horizontal Facing Angle Of(Host Player) <= -45);
		Global.directionstring = Custom String("West");
	End;
	Wait(0.250, Ignore Condition);
	Loop;
}

The South Else If is just a “fancy” way to avoid using two comparisons and a Or.

You might have to replace some of them though if you want more fine grained control over specific angles; though given its running in a loop its not really worth that extra bit of accuracy.
And you’ll likely have to rotate the strings, assuming that rotation of yours wasn’t just from pulling your hair out over it not working in the first place.

1 Like