I'm looking to make a mod that displays your compass bearing (in degrees) and direction (north, south) in the bottom print text area. I'm just starting out and only have an extremely basic understanding of code, which means more specifically I barely know anything about how to script in blockland. I'm making this to enhance my TDM server a bit but also to learn a bit.
I've already written up a proof of concept script, but it's nowhere near complete and it uses syntax that's probably completely wrong. The "script" also completely relies on there being a command to call on to find the heading of each player in the server.
There are a few main things I need to know to get this to work:
• A command to find the compass bearing of each player in the server
• The most efficient way to divide up the compass bearings (000 - 359) into directional names (N, S, E, W) (currently [partially] done by all the if-else statements)
• How to format text in the print areas properly (i can probably do this in my own time)
• The best way to convert the direction numbers from the if-elses to their corresponding initials (1 to N, 2 to NE, etc.)
if (%heading > 337.5 && <= 22.5)
{
%dir = 1 //North
}
else(%heading > 22.5 && <= 67.5)
{
%dir = 2 //North-East
}
else(%heading > 67.5 && <= 112.5)
{
%dir = 3 //East
}
else(%heading > 112.5 && <= 157.5)
{
%dir = 4 //South-East
}
else(%heading > 157.5 && <= 202.5)
{
%dir = 5 //South
}
else(%heading > 202.5 && <= 247.5)
{
%dir = 6 //South-West
}
else(%heading > 247.5 && <= 292.5)
{
%dir = 7 //West
}
else(%heading > 292.5 && <= 337.5)
{
%dir = 8 //North-West
}
function bottomprintCompass(%client,%heading,%dir,%dirname)
{
%heading = //compass bearing in degrees, hopefully found by some command already in torque
%dir = //directional name (eg. North, West), defined by the plethora of if/else statements above. there's probably a more efficient way of doing this.
//need to convert the dir numbers to letters (dirname) somewhere in here
bottomprint(%client, "<just:center><font:impact:28><color:ff0000>DIR<color:ffffff>: <font:impact:28> NW<br><font:impact:28><color:ffff00>DEG<color:ffffff>: //%, 1, 1);
}
the bottomprint code is taken directly from the pirate cannon turret
please remember that all this is incomplete. I'm just here to get some help starting out and learn some new things. In regards to correctly packaging everything and making it all look nice, I'll do that at some point when all the main stuff is done.
Hopefully you guys can help me out!