To LUGNET HomepageTo LUGNET News HomepageTo LUGNET Guide Homepage
 Help on Searching
 
Post new message to lugnet.robotics.spyboticsOpen lugnet.robotics.spybotics in your NNTP NewsreaderTo LUGNET News Traffic PageSign In (Members)
 Robotics / Spybotics / 193
192  |  194
Subject: 
NQC spybot API submission
Newsgroups: 
lugnet.robotics.spybotics
Date: 
Tue, 11 Feb 2003 18:26:19 GMT
Viewed: 
6398 times
  
Here's an addition to the NQC Spybot API that lets you write programs like this:

#include "spy.nqh"

task main() {
  int x = 0;
  int t = MIN_BOTID;
  while (t < MAX_BOTID)
  {
    SetTargetID(t);
    SetTargetNote(x);
    SetWorldNote(t, x);
    x = Target(SPY_SHORTID);
    x = Target(SPY_LINKID);
    x = Target(SPY_RANGE);
    x = Target(SPY_DIRECTION);
    x = Target(SPY_ASPECT);
    x = Target(SPY_INFO);
    x = Target(SPY_NOTE);
    GetTarget(SPY_NOTE, x);

    GetWorldShortID(t, x);
    GetWorldLinkID(t, x);
    GetWorldRange(t, x);
    GetWorldDirection(t, x);
    GetWorldAspect(t, x);
    GetWorldNote(t, x);
    t++;
  }
}



  #define NO_TARGET 255
  #define NO_ID = 0

  #define CONTROLLERID1 1
  #define CONTROLLERID2 2
  #define CONTROLLERID3 3
  #define CONTROLLERID4 4
  #define CONTROLLERID5 5
  #define CONTROLLERID6 6
  #define PCID 7
  #define MIN_BOTID 8
  #define MAX_BOTID 255

  #define RANGE_NOWHERE 0
  #define RANGE_ANYWHERE 1
  #define RANGE_THERE 2
  #define RANGE_HERE 3

  #define DIRECTION_LEFT 0
  #define DIRECTION_LEFTOFCENTER 1
  #define DIRECTION_CENTER 2
  #define DIRECTION_RIGHTOFCENTER 3
  #define DIRECTION_RIGHT 4

  #define ASPECT_FRONTLEFT 0
  #define ASPECT_FRONT 1
  #define ASPECT_FRONTRIGHT 2
  #define ASPECT_BACKRIGHT 3
  #define ASPECT_BACK 4
  #define ASPECT_BACKLEFT 5

  #define SPY_SHORTID 7
  #define SPY_LINKID 2
  #define SPY_RANGE 3
  #define SPY_DIRECTION 4
  #define SPY_ASPECT 5
  #define SPY_INFO 6
  #define SPY_NOTE 1
  #define SPY_TARGETID 0

  #define Target(n) @(0x320000 + n)
  __nolist void GetTarget(const int n, int &v)
  {
    asm { 0x14, &v : __ASM_NO_TYPE + __ASM_SMALL_VALUE, 0x32, n, 0x00 };
  }
  __nolist void SetTargetID(const int &v) { Set(Target(SPY_TARGETID), v); }
  __nolist void SetTargetNote(const int &v) { Set(Target(SPY_NOTE), v); }

  __nolist void GetWorld(const int n, int &t, int &v)
  {
    asm { 0x14, &v : __ASM_NO_TYPE + __ASM_SMALL_VALUE, 0x2a + n,
                &t : __ASM_NO_TYPE + __ASM_SMALL_VALUE, 0x00 };
  }
  __nolist void GetWorldShortID(int &t, int &v) { GetWorld(SPY_SHORTID, t, v); }
  __nolist void GetWorldLinkID(int &t, int &v) { GetWorld(SPY_LINKID, t, v); }
  __nolist void GetWorldRange(int &t, int &v) { GetWorld(SPY_RANGE, t, v); }
  __nolist void GetWorldDirection(int &t, int &v) { GetWorld(SPY_DIRECTION,
t, v); }
  __nolist void GetWorldAspect(int &t, int &v) { GetWorld(SPY_ASPECT, t, v); }
  __nolist void GetWorldNote(int &t, int &v) { GetWorld(SPY_NOTE, t, v); }
  __nolist void SetWorldNote(int &t, const int &v)
  {
    asm { 0x05, 0x2b, &t : __ASM_NO_TYPE + __ASM_SMALL_VALUE, &v};
  }



1 Message in This Thread:

Entire Thread on One Page:
Nested:  All | Brief | Compact | Dots
Linear:  All | Brief | Compact
    

Custom Search

©2005 LUGNET. All rights reserved. - hosted by steinbruch.info GbR