|
Another addition to spy.nqh :
#define REL_GT 0
#define REL_LT 1
#define REL_EQ 2
#define REL_NE 3
__nolist void FindWorld(int &v, const int relsrc, const int crit, const int&
thresh)
{
asm { 0xd5, &v : 0x3000001, 0x2a + relsrc, crit, &thresh : __ASM_SMALL_VALUE
};
}
__nolist void ClearWorld() { asm { 0x36 }; }
Now you can write loops using FindWorld to iterate through the world relation
table (as per the contrived example below). Now if we can all just squeak
loudly enough perhaps we can persuade Dave Baum to add support for subroutines
which take parameters (using the stack) and that can call other subroutines to
NQC. :-)
#include "spy.nqh"
task main()
{
int x = 40;
int t = -1;
ClearWorld();
FindWorld(t, SPY_RANGE, REL_GT, RANGE_NOWHERE);
while (t != -1)
{
SetTargetID(t);
SetWorldNote(t, 40);
SetTargetNote(x);
GetWorld(SPY_SHORTID, t, x);
x = Target(SPY_SHORTID);
GetWorld(SPY_LINKID, t, x);
x = Target(SPY_LINKID);
GetWorld(SPY_RANGE, t, x);
x = Target(SPY_RANGE);
GetWorld(SPY_DIRECTION, t, x);
x = Target(SPY_DIRECTION);
GetWorld(SPY_ASPECT, t, x);
x = Target(SPY_ASPECT);
GetWorld(SPY_INFO, t, x);
x = Target(SPY_INFO);
GetWorld(SPY_NOTE, t, x);
x = Target(SPY_NOTE);
FindWorld(t, SPY_RANGE, REL_GT, RANGE_NOWHERE);
}
}
|
|
Message has 2 Replies:
5 Messages in This Thread:
- Entire Thread on One Page:
- Nested:
All | Brief | Compact | Dots
Linear:
All | Brief | Compact
|
|
|
|