Well minimap.clickCompass() specifically is a procedure, so doesn't give you that capability.
But any routine that is a function which returns a boolean (such as minimap.isFlagPresent()) you could assign to the result of the function.
Simba Code:
compass := minimap.isFlagPresent();
or even
Simba Code:
if (minimap.isFlagPresent()) then
. It can be used exactly like any old boolean, since it returns one.
If you want to get really cool, I suppose you could modify .clickCompass() to return a boolean, but I'm not sure if that would be useful considering the nature of the routine.
***
More to the point of your question, you could use a case statement if you really wanted to randomize the angle, here's how I do it:
Declare these
Simba Code:
const
MM_DIRECTION_NORTHEAST = 45;
MM_DIRECTION_SOUTHEAST = 135;
MM_DIRECTION_SOUTHWEST = 225;
MM_DIRECTION_NORTHWEST = 315;
and then call this
Simba Code:
function TRSMinimap.randomAngle(return:boolean = false):boolean; //Turns to a random angle. Returns to original if "return" is true.
var
a, b:extended;
begin
writeDebug('Altering angle direction');
a := self.getAngleDegrees();
writeDebug('Angle is currently ' + toStr(a));
case random(8) of
0: self.setAngle(MM_DIRECTION_NORTH);
1: self.setAngle(MM_DIRECTION_SOUTH);
2: self.setAngle(MM_DIRECTION_EAST);
3: self.setAngle(MM_DIRECTION_WEST);
4: self.setAngle(MM_DIRECTION_NORTHEAST);
5: self.setAngle(MM_DIRECTION_SOUTHEAST);
6: self.setAngle(MM_DIRECTION_NORTHWEST);
7: self.setAngle(MM_DIRECTION_SOUTHWEST);
end;
b := self.getAngleDegrees();
writeDebug('Angle was altered to ' + toStr(b));
if (return) then
begin
writeDebug('Returning angle to ' + toStr(a));
self.setAngle(a);
end;
end;
***
But if you wanted to be really cool, you could dump .setAngle() and use .isAngle() which I find to be a tad more efficient.
Simba Code:
function TRSMinimap.isAngle(deg:extended; turnTo:boolean = false):boolean; //Returns true if the current compass angle is within a few degrees of "deg"
var //Will also turn to "deg" if turnTo is true.
a:extended;
begin
a := self.getAngleDegrees();
result := inRange(round(a), (deg - 5), (deg + 5));
writeDebug('isAngle(): angle is currently ' + toStr(a) + ', threshold was ' + toStr(deg) + ', returning ' + lowercase(toStr(result)) + '');
if (not (result)) then
if (turnTo) then
begin
writeDebug('isAngle(): altering angle to ' + toStr(deg));
self.setAngle(deg);
end;
end;