n3ss3s
2008-11-08 03:02:41
Reflection seemed a bit bare as the title so… ffs I'm crap at writing tutorials, they never end up as mighty and huge as I thought :(
Hooks
"Hooks", are field paths, which bots use to get information from the client.
Example, SmartGetFieldInt(0, 'me.h'). That would get the h -integer of the me -class.
People use "Updaters" to get the hooks their want, if you want to know more about those you should try searching at mopar…
SMART Functions
SmartGetFieldInt(Parent, Path) returns either the integer in the client in the Parent class, something like SmartGetFieldInt(GetPlayer, HP) for example.
Or, the integer in the client in the Path.
SmartGetFieldBoolean(Parent, Path) is the same as above, except it returns a boolean.
SmartGetFieldObject(Parent, Path), this is nice. This can return umm… Entire classes? I don't know how to say it correctly…
Object finding, for example, uses this.
There are all kinds of handy uses for these "Objects", for example, we can retrieve strings from them!
First, we do A := SmartGetFieldObject(Obj, StringBytes), and then StringFromBytes(A), we have just retrieved a string from the client :)
All of these functions have their 2D and 3D functions, some examples of their usages…
And ofcourse my function for seeing if a tile is walkable ;)
ffs I'm crap at writing tutorials, they never end up as mighty and huge as I thought :(
So let's do so that you ask, I answer, ok?
Hooks
"Hooks", are field paths, which bots use to get information from the client.
Example, SmartGetFieldInt(0, 'me.h'). That would get the h -integer of the me -class.
People use "Updaters" to get the hooks their want, if you want to know more about those you should try searching at mopar…
SMART Functions
SmartGetFieldInt(Parent, Path) returns either the integer in the client in the Parent class, something like SmartGetFieldInt(GetPlayer, HP) for example.
Or, the integer in the client in the Path.
SmartGetFieldBoolean(Parent, Path) is the same as above, except it returns a boolean.
SmartGetFieldObject(Parent, Path), this is nice. This can return umm… Entire classes? I don't know how to say it correctly…
Object finding, for example, uses this.
obj := SmartGetFieldObject(Z, getObj[I]);
//WriteLn('Object is '+inttostr(obj)+' on getObject1 in '+inttostr(Q)+' ground layer');
If obj <> 0 Then
Begin
Result.UID.High := SmartGetFieldLongH(obj, getUIDs[I]);
Result.UID.Low := SmartGetFieldLongL(obj, getUIDs[I]);
Result.objType := GetObjectType(Result.UID);
SmartFreeObject(obj);
//SmartFreeObject(Z); // Causes scar to crash
Exit;
End;There are all kinds of handy uses for these "Objects", for example, we can retrieve strings from them!
First, we do A := SmartGetFieldObject(Obj, StringBytes), and then StringFromBytes(A), we have just retrieved a string from the client :)
All of these functions have their 2D and 3D functions, some examples of their usages…
BsX := SmartGetFieldInt(0, BaseX);
BsY := SmartGetFieldInt(0, BaseY);
Plane := SmartGetFieldInt(0, BaseLayer);
NodeList := SmartGetFieldArray3DObject(0, getNodeListArray, Plane, TileX - BsX, TileY - BsY);And ofcourse my function for seeing if a tile is walkable ;)
Function IsWalkable(X, Y: Integer): Boolean;
Var
GroundData, BX, BY, Blocks, blx, bly: Integer;
Begin
Bx := SmartGetFieldInt(0, BaseX);
By := SmartGetFieldInt(0, BaseY);
GroundData := SmartGetFieldArrayObject(0, getGroundDataArray, SmartGetFieldInt(0, BaseLayer));
If (SmartGetFieldArray2DInt(GroundData, getBlocks, X - Bx, Y - By) And $1280108) = 0 Then
Result := True;
SmartFreeObject(GroundData);
End;ffs I'm crap at writing tutorials, they never end up as mighty and huge as I thought :(
So let's do so that you ask, I answer, ok?