Inconsistent behavior of Pawn.Target() and Pawn.Face()

Fahrice

Active Member
I'm just messing around with this trying to get the hang of it. Using the sample VS solution, I've managed to tool around and echo messages to the console about various game data.

I decided to start exploring further, so I decided to start with targetting/facing other objects in the area. Here is the basic code:

Code:
Extension Ext = new Extension();

string type = "Crafting Station";
string target = "Blacksmith Forge";

Ext.Pawn(type, target).Target();
Ext.Pawn(type, target).Face();
I also figured maybe having it search using (type, target) for each action was inefficient, so I tried the following to see if I could get it to work.

Creating a Pawn object to work with:

Code:
Pawn thisPawn = Ext.Pawn(type, target);

thisPawn.Target();
thisPawn.Face();
Getting the Pawn's place in the Pawn list and referencing it using that:

Code:
int pawnID = 0;

for (int thisPawnID = 1; thisPawnID <= Ext.VG().PawnCount - 1; thisPawnID++)
{
     if ((Ext.Pawn(thisPawnID).Name == target) && (Ext.Pawn(thisPawnID).Type == type))
     {
          pawnID = thisPawnID;
          break;
     }
}

Ext.Pawn(pawnID).Target();
Ext.Pawn(pawnID).Face();

Basically I've tried several different ways of trying to target an object, then face it. The first one I posted above with (type, target) as parameters works sometimes, but again - it's extremely inconsistent.

Can anyone provide some insight as to what I'm doing wrong or give any hints on the correct way to do what I'm trying to do?

Thanks!
 

Fahrice

Active Member
I believe I figured out the solution to the problem.

I wasn't properly using Frame.Lock() and Frame.Unlock().

Can someone confirm - you must Frame.Lock() before calling any method or accessing any property that performs an action or reads or sets a value in the running game's memory space?

Sorry, I'm a noob and have never used Inner Space or ISXVG until a couple days ago.

Thanks!
 

Grep

Active Member
Probably me just being dumb, but where are you finding the sample files? I've been looking for this for a couple of days but can't seem to locate them.
 

MstrGareth

Active Member
Fahrice said:
I believe I figured out the solution to the problem.

I wasn't properly using Frame.Lock() and Frame.Unlock().

Can someone confirm - you must Frame.Lock() before calling any method or accessing any property that performs an action or reads or sets a value in the running game's memory space?

Sorry, I'm a noob and have never used Inner Space or ISXVG until a couple days ago.

Thanks!
Yup, anytime you access anything via "Extension" it seems it needs to be locked and unlocked.

Code:
           Extension VGE = new Extension(); 
           LavishVMAPI.Frame.Lock();
            VGE.Pawn("NPC").Target();
            LavishVMAPI.Frame.Unlock();
 
Top Bottom