Summary of Function CollectionNote: the functions about callbacks have been described in Plugin SDK2 help file and they are missing in current table |
|||
Name | Link | Example | Description |
AbsDiff() AbsDiffY() AbsDiffO() |
help |
Distance=AbsDiff(GET.pLara->CordX, GET.pItem->CordX); or Difference= AbsDiffO(GET.pLara->OrientationH, 0x4000); |
int AbsDiff(DWORD First, DWORD Second) int AbsDiffY(int First, int Second) int AbsDiffO(short First, short Second); These functions compute the absolute difference between two values, usually we'll be coordinates of items or values of orienting (facing). The AbsDiff() will be used for X and Z coordinates The AbsDiffY() for Y coordinates The AbsDiffO() for difference between Orienting (facing) |
AlignLaraAtPosition() | help |
// supposing that we wish align lara with an item with index: ObjectIndex // if there is alignment in progress with current item: call newly AlignLaraAtPosition(): if (Trng.pGlobTomb4->TestAlignmentInProgress == true && *Trng.pGlobTomb4->pAdr->pObjectActive == ObjectIndex) { if (AlignLaraAtPosition(&CtrlCraneTestPosition, ObjectIndex == false) return; // lara is aligned.. // ... here you perform the code after the alignment } if (CheckPositionAlignment(&MyPosition, ObjectIndex) == true){ // Lara is about aligned with object // now we begin the alignment loop with first call to AlignLaraAtPosition if (AlignLaraAtPosition(&MyPosition, ObjectIndex)== false) { // lara is not yet aligned: quit current code // and at next frame we'll repeat above functions return; } // lara is already aligned // ... code to perform when lara is ideal position } |
bool AlignLaraAtPosition(StrTestPositionCmd *pTestPosition, int ObjectIndex) Move lara to align her to ideal position tested in previous call of CheckPositionAlignment() function. AlignLaraAtPosition() will return "false" until the alignment is yet in progress, while it will return "true" when the alignment has been completed. |
CheckDirection() | help |
if (CheckDirection(GET.pLara, -720, IndexOfEnemy, -500, 0x2500, 0x800)==true) { //lara is able to see the enemy } |
bool CheckDirection(StrItemTr4 *pSourceItem, int OffSourceY, int TargetIndex, int OffTargetY, short TolleranceH, short TolleranceV); Verify is source item pSourceItem is able to see target with TargetIndex, in according with given field of vision set by horizontal and vertical tollerance. |
CheckFloor() | help |
CheckFloor(GET.pLara->CordX, GET.pLara->CordY, GET.pLara->CordZ, Get.pLara->Room); |
bool CheckFloor(DWORD x, int y, DWORD z, int RoomIndex) It analyses the point of 3d world, (x,y,z) you give as input arguments, and discovers data about room collision of the sector where that point falls. The found data will be saved in FLOOR global structure. |
CheckPositionAlignment() | help |
StrTestPositionCmd MyData; if (CheckPositionAlignment(&MyData, ObjectIndex) == true) { // Lara is correctly aligned with object } |
bool CheckPositionAlignment(StrTestPosition *pTestPosition, int ObjectIndex); This function is that procedure used to apply the script command TestPosition. When we wish that lara interacted with some object where it's important that her start position was correct respect to the object, we can use this function to verify her correct alignment. |
ClearMemory() | help | ClearMemory(&MyData.Local, sizeof(StrSavegameLocalData)); |
void ClearMemory(void *pZone, DWORD SizeBytes) Set to 0 all bytes of givem memory address of SizeBytes lenght. |
CompareTrngVersion() | help | if (CompareTrngVersion(VetVersionNumbers) > 0) |
int CompareTrngVersion(WORD VetVersion[]) Compare tomb_nextgeneration version with the given version number and returns if trng has a version higher (+1), lower (-1) or the same (=0). |
Convert() | help |
// convert the ngle index NgleIndex to get the real (tomb) item index ItemIndex = Convert(enumCONV.ItemIndexFromNgleToTomb, NgleIndex,0,NULL); |
int Convert(int CONV_Type, int Index, int SecondaryIndex, void * pPointer); This function works like a multiple converter. First parameter has to be a CONV value that you can insert using the selfenumerator enumCONV You can choose between many different conversion functions: From Ngle Index to Tomb Index (about moveable item indices) and viceversa From Ngle Static Index to Tomb Static Indices and viceversa From Relative animation index to absolute anim index and viceversa From Relative frame index to absolute index and viceversa From Ngle Room Index to Tomb Room index and viceversa From rect box of microunits to real pixel values, in according with current screen resolution |
ConvertFromStrItemToItemIndex() | help |
int ItemIndex; StrItemTr4 *pItem; ItemIndex = ConvertFromStrItemToItemIndex(pItem); |
int ConvertFromStrItemToItemIndex(StrItemTr4 * pItem); When you know only the address of some item's structure and you wish discovering its index, you can use this function. Please note that, if the pointer you supply is NULL, the function will return -1 and an error message will be sent to the log. |
CreateAIObject() | help |
int OcbCreated; // create a LARA_START_POS item with given position, requiring an ocb value for it, never used in other item of same kind: OcbCreated = CreateAIObject(enumSLOT.LARA_START_POS, x, y, z, Room, -1, enumORIENT.SOUTH); // call action 40 to move immediately enemy with index IndexEnemy in same position of LARA_START_POS with ocb we got PerformActionTrigger(NULL, 40, IndexEnemy , OcbCreated); // delete the LARA_START_POS we had created: DeleteAIObject(enumSLOT.LARA_START_POS, OcbCreated, false); |
int CreateAIObject(WORD Slot, DWORD CordX, int CordY, DWORD CordZ, WORD Room, int OcbValue, short Facing); You can create dynamically a new null mesh item (like all AI_ items + LARA_START_POS), giving the coordinate and room for this new item. You should supply also the Ocb value for this item, anyway you can set -1 as Ocb value to get from this function a new ocb value different of all others to avoid conflicts. Note: once you used this new item, you should remember to delete it using the DeleteAIObject() function |
CreateNewMoveable(); | help |
int IndexGrenade; IndexGrenade=CreateNewMoveable(enumSLOT.GRENADE, GET.pLara->CordX, GET.pLara->CordY - 760, GET.pLara->CordZ, GET.pLara->Room ); Get(enumGET.ITEM, IndexGrenade,0); GET.pItem->SpeedH = 64; GET.pItem->SpeedV = -10; |
short CreateNewMoveable(WORD Slot, DWORD CordX, int CordY, DWORD CordZ, int Room); This function create dynamically a new moveable item, placing it in the given position (x,y,z and room), then it returns the index of just created item. When you finished to use this moveable, and you have alreadky killed it you should remove it using also the DeleteNewMoveable() function |
DeleteAIObject() | help |
int OcbCreated; // create a LARA_START_POS item with given position, requiring an ocb value for it, never used in other item of same kind: OcbCreated = CreateAIObject(enumSLOT.LARA_START_POS, x, y, z, Room, -1, enumORIENT.SOUTH); // call action 40 to move immediately enemy with index IndexEnemy in same position of LARA_START_POS with ocb we got PerformActionTrigger(NULL, 40, IndexEnemy , OcbCreated); // delete the LARA_START_POS we had created: DeleteAIObject(enumSLOT.LARA_START_POS, OcbCreated, false); |
void DeleteAIObject(WORD Slot, WORD OcbValue, bool TestAlls); Once you create a new AI item with CreateAIObject() function and you are sure to have no more need of it, you should remember to delete it, because the AI items are a shared limited resource and it's better do not wasting them. You should supply as input parameters, the Slot of item to delete, the Ocb value you got from CreateAIObject() function when you had created it, while about TestAlls argument, it means if you wish delete all item with that slot and that ocb value. Theoratically it should get same result since it's not foreseen that there were two item with same slot and same ocb value. |
DeleteNewMoveable() | help | DeleteNewMoveable(IndexNewItem); |
void DeleteNewMoveable(short Index); You should use this function to remove the new moveable you had created using the CreateNewMoveable() function. The Index value will be the same you got from CreateNewMoveable() function when you had created that moveable. Note: you should call DeleteNewMoveable() function only after you killed/removed it from the game. |
DetectedGlobalTriggerEvent() | help |
DetectedGlobalTriggerEvent(GT_LARA_ON_ELEV_FLOOR, 2, false); |
bool DetectedGlobalTriggerEvent(int GT_Event, int Parameter, bool TestIgnoreParameter) Inform trng that a GT_ event is just happened. |
DisableSaving() | help |
// disable the chance to save the game for 15 frames (half second) DisableSaving(15); |
void DisableSaving(int FrameDurate); Get impossible for the player to save the game for next FrameDurate frames. This function should be used before beginning an action where we don't wish that the game was saved before that acion has been completed. In this case you'll set as FrameDurate the durate of that action + one frame. |
EndMoveItem() | help |
// before moving item with ItemIndex StartMoveItem(ItemIndex); // moving the item index MoveMyItem(ItemIndex); // completed the movement: EndMoveItem(ItemIndex); |
void EndMoveItem(int ItemIndex); This function should be called everytime you completed the moving of some moveable. You should have already called the twin function: StartMoveItem() function, when you had started the moving. This function will handle further floor collision for pushable objects. |
Find() | help |
if (Find(enumFIND.AI, enumSLOT.LARA_START_POS, -1, 3,-1, NULL)==false ) { SendToLog("ERROR: cann't find LARA_START_POS with OCB=3"); } |
bool Find(int FindType, short SlotType, short RoomIndex, short Ocb, int Extra, void *pPointer) Perform a research of given FIND_ type items, suppling arguments that will have to match with found items. |
ForceAnimationForItem() | help |
;force animation 4 and let default stateid set in animation data ForceAnimationForItem(pItem, 4, -1); |
void ForceAnimationForItem(StrItemTr4 *pItem, int NumAnimation, int NextStateId); Set a new animation for moveable (different than lara). You can also set the next state id for enemy, or, if you use "-1" let the default next state id set in animation data. |
ForceAnimationForLara() | help |
;force in lara the animation to push a pushable object (123) ;letting as next state id the same state id of animation 123 ForceAnimationForLara(123, -1); |
void ForceAnimationForLara(int NumAnimation, int NextStateId); Set a new animation for Lara and change also nextstateid, or, giving as NextStateId = -1, let the state id of future animation to set the next state id of Lara |
FormatText() | help | FormatText("CordXLara=%d", GET.pLara->CordX); |
char *FormatText(char *szFormat, ...) This function allow to format text with arguments like decimal numbers "%d", hexadecimal numbers "%x", texts "%s" ect. |
FreeMemory() | help | FreeMemory(pMemory); |
void FreeMemory(void *pMem) Free the memory previously allocated with GetMemory() function |
FromNgleIndexToTomb4Index() | help | TombIndex= FromTomb4IndexToNgleIndex(1032); |
int FromNgleIndexToTomb4Index(int NgleIndex) Convert the index of moveable from ngle index (you see in NGLE program) to internal tomb raider index |
FromNgleStaticIndexToTomb4Indices() | help | FromNgleStaticIndexToTomb4Indices(MyIndex, &RoomIndex, &StaticIndex); |
bool FromNgleStaticIndexToTomb4Indices(int IndiceNgle, int *pRoomIndex, int *pStaticIndex) Convert a ngle index about a static item, in two indices to access in tomb raider to that static: the index of room that owns that static, and the tomb index of the static item. |
FromStaticIndicesToNgleIndex() | help |
int NgleIndex; ;supposing that RoomIndex is index of room and StaticIndex is index of static in that room NgleIndex= FromStaticIndicesToNgleIndex(RoomIndex,StaticIndex); SendToLog("Static with ngle index=%d", NgleIndex); |
int FromStaticIndicesToNgleIndex(int RoomIndex, int StaticIndex); Used only for debugging, this fucntion allow to discover what is the index of some static using NGLE indices, suppling two tomb indices: roomindex and tomb static index |
FromTomb4IndexToNgleIndex() | help | NgleIndex=FromTomb4IndexToNgleIndex(TombIndex); |
int FromTomb4IndexToNgleIndex(int TombIndex); This function is the opposite of FromNgleIndexToTomb4Index() function. When you have a tomb raider index and you want discover what is the corresponding ngle index, you use this function. |
Get() | help | Get(enumGET.LARA,0,0); |
bool Get(int GET_Type, int Index, int SecondaryIndex) Get() function will copy in GET structure the data you required with enumGET constant. You can get structures about moveables, statics, collision, script commands, rooms ect. |
GetAlignedOrient() | help |
int GapValue; short IdealFacing; GET(enumGET.LARA, 0,0); IdealFacing = GetAlignedOrient(GET.pLara->OrientationH, true, &GapValue); if (IdealFacing == enumORIENT.SOUTH && GapValue <= 0x800) { // lara is looking (about) at south } |
short GetAlignedOrient(WORD Orient, bool TestForceHortogonal, int *pGap) Returns a ORIENT_ value (facing, direction) aligned with one of eight basic facing: north; south; east; west; north-west; south-west; south-east or north-east |
GetCallBack() | help | GetCallBack(CB_FLIPEFFECT, CBT_FIRST, 64, cbFlip64); |
bool GetCallBack(int CallBackCB, int CBT_Flags, WORD Index, void *pProc) Require to trng to call your function when the program is managing a particular stuff described by CB_ constant |
GetCurrentFrame() | help |
int FrameNow; Get(enumGET.LARA,0,0); // discover the number of current frame of current animation of Lara FrameNow = GetCurrentFrame(GET.pLara); |
int GetCurrentFrame(StrItemTr4 *pItem); Returns the current frame number of current animation for the given moveable. This is a relative number, where first frame of animation will be = 0 |
GetDirection() | help | Orient= GetDirection(GET.pLara->CordX, GET.pLara->CordZ, TargetX, TargetZ); |
WORD GetDirection(DWORD SourceX, DWORD SourceZ, DWORD TargetX, DWORD TargetZ); It returns the facing that,from source point, is looking at target point. |
GetDistanceXZ() | help | Dist= GetDistanceXZ(GET.pLara->CordX, GET.pLara->CordZ, GET.pItem->CordX, GET.pItem->CordZ); |
int GetDistanceXZ(DWORD SourceX, DWORD SourceZ, DWORD TargetX, DWORD TargetZ); It returns the distance between two points ignoring the Y axis (height in vertical). |
GetDistanceXZY() | help | GetDistanceXZY(GET.pLara->CordX, GET.pLara->CordY, GET.pLara->CordZ, X, y, z); |
int GetDistanceXZY(DWORD SourceX, int SourceY, DWORD SourceZ, DWORD TargetX, int TargetY, DWORD TargetZ); It returns the distance between two points, source and target, in 3d world in game units. |
GetIncrements() | help | GetIncrements(GET.pLara->OrientationH, &IncX, &IncZ, 128); |
void GetIncrements(WORD Facing, int *pIncX, int *pIncZ, int Distance); It computes the single values on X and Z axis to add to the source X,Z coordinate to the point at Distance distance in Facing direction. |
GetMaxDistance() | help |
if (GetMaxDistance(& GET.pLara->CordX , & GET.pItem->CordX, false) < 1024) { // Lara is very closed to pItem } |
int GetMaxDistance(DWORD *pSource, DWORD *pTarget, bool TestIgnoreY); It return the distance the max distance on one of three axis (or two if TestIgnoreY==true). This distance will be greater or even than real distance but never lower |
GetMemory() | help | pMemory = (BYTE *) GetMemory(1000); |
void *GetMemory(DWORD SizeOfMemory) Get a memory zone free of SizeOfMemory bytes. |
GetString() | help | pText= GetString(21 | STRING_NG); |
char * GetString(int StringIndex) You can get the text of any string, ng strings, pc, psx ect, supplying their index. |
IsCollideWithStatic() IsCollideWithMoveable() |
help |
if (IsCollideWithMoveable(GET.LaraIndex, IndexTrap, 0) == true) { // lara is touching the trap } if (IsCollideWithStatic(GET.LaraIndex, 54 | NGLE_INDEX, -1, 0)==true) { // lara is colliding with static with (ngle) index 54 } |
bool IsCollideWithStatic(int IndexItem, int StaticIndex, int StaticRoomIndex, int Tollerance); bool IsCollideWithMoveable(int IndexPrimaryItem, int IndexSecondaryItem, int Tollerance); Both functions verify if a moveable (primary) item is colliding with another item. Only difference is if the other item is a moveable (you have to use IsCollideWithMoveable() function) or a static item (you'll use the IsCollideWithStatic() function) |
IsCollidingWithSomeItem() | help |
DWORD NewSizeX; DWORD NewSizeZ: int IncX; int IncZ; GetIncrements(GET.pLara->OrientationH, &IncX, &IncZ, 40); NewSizeX=GET.pLara->CordX + IncX; NewSizeZ=GET.pLara->CordZ + IncZ; if (IsCollidingWithSomeItem(GET.LaraIndex, NewSizeX, GET.pLara->CordY, NewSizeZ, GET.pLara->Room, 2048, 0,0,0) == true) { // lara cann't move forware by 40 game units,othewise // she will collide with some item return; } |
bool IsCollidingWithSomeItem(int ItemIndex, DWORD x, int y, DWORD z, int RoomIndex, int MaxDistance, int MinLargerSide, int MinHeight, int Tollerance); It will search, in supplied roomidex and in all rooms immediatly closed with it, if there are moveable items or static items that could collide with moveable linked with ItemIndex once it has been moved in new (x,y,z) position. Last four parameters are used to filter the research in according with some feature of items whose we are checking the collision. |
IsFullScreenMode() | help | if (IsFullScreenMode()==true) |
bool IsFullScreenMode(void); Verify if tomb raider is running in exlusive full screen mode. When the |
IsThereFile() |
help |
if (IsThereFile("data\\sgBonus.tr4")==false) { SendToLog("ERROR: missing bonus level in data folder"); } |
bool IsThereFile(char *pFileName) Checks if exist on disk the file of given path: pFileName |
LoadFile() | help | pMemory = LoadFile("settings.bin"); |
BYTE *LoadFile(char *pFileName, DWORD *pSize) LoadFile() allow you to load some external file in the memory and it will return to you the address (memory pointer) of memory where it has been loaded, and the size of the file. |
LogOnDebug(); | help |
Get(enumGET.GAME_INFO,0,0); LogOnDebug("cbInitLevel() function for level = %d", GET.GameInfo.LevelIndex); |
bool LogOnDebug(char *szFormat, ...); This funtion will send the message you supplied as argument, to tomb4_log window or to log panel of Visual Express debugger. The input arguments are the same of SendToLog() function |
PerformActionTrigger() | help | PerformActionTrigger(NULL, 43, 20 | NGLE_INDEX, 3); |
void PerformActionTrigger(char *pPluginName, int ActionNumber, int ObjectIndex, int ExtraTimer) You can perform an action trigger in direct way with PerformActionTrigger() function. You get all arguments of this function, directly from ngle using the [Export Function] button of Set Trigger Type window. |
PerformConditionTrigger() | help |
if (PerformConditionTrigger(NULL, 83, 26 | NGLE_INDEX, 26) == true) { // code to perform when the condition is true } |
bool PerformConditionTrigger(char *pPluginName, int ConditionNumber, int ObjectField, int Extra) You can perform a condition of some condition trigger with PerformConditionTrigger() function. You get all arguments of this function using [Export Function] button of Set Trigger Type window. |
PerformExportedTrigger() | help | PerformExportedTrigger(NULL, 0x2000, 116, 0x402); |
bool PerformExportedTrigger(char *pPluginName, int Arg1, int Arg2, int Arg3) Perform the trigger corresponding to the three exported (for script) trigger you got with [Export Script Trigger] button of Set Trigger Type window. |
PerformFlipeffect() | help | PerformFlipeffect(NULL, 280, 4, 4); |
bool PerformFlipeffect(char *pPluginName, int FlipNumber, int Arg1, int Arg2) With PerformFlipeffect() function you can perform any available flipeffect trigger, of trng or other plugin. You get all arguments with [Export Function] button of Set Trigger Type window. |
PerformTriggerGroup(); | help |
// perform triggergroup with ID = 12 PerformTriggerGroup(12); |
int PerformTriggerGroup(int IdOfTriggerGroup); This function perform the triggergroup of the script with given ID. If the triggergroup contains conditional triggers you can test value returned where "1" means "true" and "0" means "false" |
ReadMemVariable(); and WriteMemVariable(); |
help |
int StateId; WORD Timer; // read an Item memory field that should corrspond to state id // the code has been taken from a trigger and it is in Timer variable StateId= ReadMemVariable(Timer | enumMEMT.ITEM); // set -1 as amount of some inventory item whose code is in // Timer variable WriteMemVariable(Timer | enumMEMT.INVENTORY , -1); |
int ReadMemVariable(int Code); void WriteMemVariable(int Code, int Value); With these two functions you can access, on reading or writing, to any kind of Memory variables, using as access the value got from some trigger's parameter. To set what kind of memory variable to access, you have to add (with or operato "|") one of enumMEMT. constants that include: #define SAVEGAME, CODE, ITEM, SLOT, ANIMATION and INVENTORY |
ReadNumVariable() and WriteNumVariable() |
help |
int Value; WORD Timer; // read the value of Store Long A trng variable Value= ReadNumVariable(0x01C0 | SCRIPT_CODE); // write Value in trng variable whose code is in Timer variable WriteNumVariable(Timer, Value); |
int ReadNumVariable(int Code); void WriteNumVariable(int Code, int Value); With these two functions you can access, reading or writing, to NUMERIC trng variables, using a code to locate them. This code could be the same you see in NG_Center's Reference Panel, VARIABLE PLACEFOLDERS section, or the value you get from a trigger argument. Follow the help link to have a better description about Code parameter. |
ReadTextVariable(); and WriteTextVariable(); |
help |
char *pString; // read the text in Last Input Text trng variable pString = ReadTextVariable(0x0400 | SCRIPT_CODE); // write in text variable whose code is in Timer variable // the "Hello World" constant string WriteTextVariable(Timer, "Hello World"); |
char* ReadTextVariable(int Code); void WriteTextVariable(int Code, char *pText); With these two functions you can access, reading or writing, to TEXT trng variables, using a code to locate them. This code could be the same you see in NG_Center's Reference Panel, VARIABLE PLACEFOLDERS section, or the value you get from a trigger argument. Follow the help link to have a better description about Code parameter. |
ResizeMemory() | help | pMemory= ResizeMemory(pMemory, 800); |
void *ResizeMemory(void * pOldMemory, DWORD NewSize) Change the size of a memory zone previously allocated using GetMemory() |
SendErrorToDiskLog() | help | SendErrorToDiskLog("ERROR: this plugin cann't work with current version of tomb_nextGeneration.dll. The plugin will quit"); |
void SendErrorToDiskLog(char *pMessage, DWORD PluginID, bool TestMsgBox) Send a message to log file saved on disk with name: "Plugin_YourName_warm_up_log.txt" |
SendToLog() | help | SendToLog("Lara Y Coordinate = %d", GET.pLara->CordY); |
void SendToLog(char *pMessage); Send to log file, caught by tomb4_log.exe program, the given text with further dynamic (variables) parameters you set. |
Service() | help | Service(SRV_CREATE_TRIGGERGROUP, 0x2000, 121, 0xA44, END_LIST); |
int Service(DWORD SRV_Type, ...); Service() is a low-level function to call a trng service. See list of SRV_ constants in tomb_nextgeneration.h file or the list of enumSRV autoenumerate. |
SetCamera() | help |
// look lara's face SetCamera(-1, 0x8000, -1, 1); |
void SetCamera(int Distance, int HOrient, int VOrient, int Speed); Change one or more of the parameters to set the position of camera is looking Lara. If you don't wish change some parameter you can type -1 to let that value unchanged. Speed value is for number of frames to spend to pass from previous camera position to that you set. Minimun value is 1 (one frame) |
SetCurrentFrame() | help |
// Force for lara, animation 32 at frame 5 Get(enumGET.LARA,0,0); ForceAnimationForLara(32, -1); SetCurrentFrame(GET.pLara, 5); |
void SetCurrentFrame(StrItemTr4 *pItem, int Frame); You can change the frame for current animation of given moveable (with pItem structure) with this function. You can use relative frame indices, where 0= first frame, 1=second frame ect. |
SignalMovedItem() | help |
GetIncrements(ORIENT_NORTH, &IncX, &IncZ, 256); GET.pItem->CordX += IncX; GET.pItem->CordZ += IncZ; UpdateItemRoom(IndexItem); SignalMovedItem(IndexItem); |
void SignalMovedItem(int IndexItem); Mark the moveable item with index IndexItem as a moveable whose it's necessary saving in savegame the position. To use only when you moved a moveable different than a creature using your code insteady by using action triggers. |
StartMoveItem() | help |
// before moving item with ItemIndex StartMoveItem(ItemIndex); // moving the item index MoveMyItem(ItemIndex); // completed the movement: EndMoveItem(ItemIndex); |
bool StartMoveItem(int ItemIndex); This function inform trng about the item you are going to move. In the case it was a pushable with floor collision, trng will apply right procedure to get sure the moving. Note: when you completed the movement, you have to call the twin function: EndMoveItem() function |
TestEnvCondition() | help | if (TestEnvCondition(-1, enumENV.CLIMB_WALL_IN_FRONT, enumENV.POS_STRIP_1 + enumENV.POS_HORTOGONAL, -1, 0)==true) |
bool TestEnvCondition(int ItemIndex, int EnvCondition, int EnvPosFlags, int DistanceEnv, int Extra); With this fucnction you can test an ENV_ condition about Lara or about the enemy with ItemIndex you supply. |
TryMessageBox() | help |
TryMessageBox("ERROR: FMV has an unknow format"); |
bool TryMessageBox(char *pMessage); Show a pop-up window with the given message, if it is possible. Anyway it will be send always the message to the log. |
UpdateItemRoom() | help |
GetIncrements(ORIENT_NORTH, &IncX, &IncZ, 256); GET.pItem->CordX += IncX; GET.pItem->CordZ += IncZ; UpdateItemRoom(IndexItem); |
bool UpdateItemRoom(int ItemIndex); To call after having moved a moveable item to update its room index. |
Code to access to Trng and Memory Variables |
|||
Variable Group | Code Type (its origin, from where you got it) | Flags (further values to add to the Code) | Description |
Numeric Trng |
#VAR_NORMALS# preset trigger argument Example of this list: F231 trigger, timer field |
no flag |
You can pass the value of this trigger parameter, to ReadNumVariable() or WriteNumVariable() functions, omitting any kind of flag. This kind of code will access to all trng numerical variables, excluding the "store" variables. |
" " " |
#VAR_STORES# preset trigger argument Example of this list: F236 trigger, timer field |
VAR_TYPE_STORE |
When you got a code for current "store" preset list, you need to add to this value the VAR_TYPE_STORE flag. It's better using the "or" operator to perform this operation, i.e. the "|" operator. For instance, if in Timer variable there is the trigger's argument, to read the value of corresponding numeric variable, you should type a code like this: Value=ReadNumVariable(Timer | VAR_TYPE_STORE); |
" " " |
#VAR_LONG_STORE# preset trigger argument Example of this list: A55 trigger, extra timer field |
VAR_TYPE_LONG_STORE |
When you got a code for current "long store" preset list, you need to add to the VAR_TYPE_LONG_STORE flag to trigger parameter. It's better using the "or" operator to perform this operation, i.e. the "|" operator. For instance, if in Timer variable there is the trigger's argument, to read the value of corresponding numeric variable, you should type a code like this: Value=ReadNumVariable(Timer | VAR_TYPE_LONG_STORE); Note: you could get same result adding to trigger code the two flags: VAR_TYPE_STORE and STORE_TYPE_LONG For instance: Value=ReadNumVariable(Timer | VAR_TYPE_STORE | STORE_TYPE_LONG); Anyway, since the VAR_TYPE_LONG_STORE flag is the sum of above two flags, it's more easy using only it, like in first example. |
" " " |
VARIABLE PLACEFOLDER script argument You find all codes in NG_Center's Reference panel in VARIABLE PLACEFOLDER section Note: The "#" sign has to be converted in "0x" in c++ syntax. |
SCRIPT_CODE |
When you got the access code from some field of script commands of yours, you have to add the SCRIPT_CODE flag to that value. For instance: int Code; int Value; // supposing in argument [3] of some Customize of yours // there is a variable placefolder // for numeric variables, we can read that variable in this way: Code = GET.pCust->pVetArg[3]; Value = ReadNumVariable(Code | SCRIPT_CODE); |
Text Trng |
#VAR_TEXT# preset trigger argument Example of this list: F238 trigger, timer field |
no flag |
You can pass the value of this trigger parameter, to ReadTextVariable() or WriteTextVariable() functions, omitting any kind of flag. This kind of code will access to all trng text variables. // example: supposing the code for text variable was in Timer variable // we can read it in this way char *pString; pString = ReadTextVariable(Timer); if (strcmpi(pString, "DALAILAMA")==0) { // the text was even than "DALAILAMA } |
" " " |
VARIABLE PLACEFOLDER script argument You find all codes in NG_Center's Reference panel in VARIABLE PLACEFOLDER section Note: The "#" sign has to be converted in "0x" in c++ syntax. |
SCRIPT_CODE |
When you got the access code from some field of script commands of yours, you have to add the SCRIPT_CODE flag to that value. For instance: int Code; char *pString; // supposing in argument [3] of some Customize of yours // there is a variable placefolder // for text variables, we can read that variable in this way: Code = GET.pCust->pVetArg[3]; pString = ReadTextVariable(Code | SCRIPT_CODE); // non pString points to some text // if (strcmpi(pString, "Shakira")==0) { // tha text variable was even than "Shakira" } |
Inventory Memory |
#MEMORY_INVENTORY# preset trigger list Example of this list: F336 trigger, extra timer field |
enumMEMT.INVENTORY |
You add the MEMT_INVENTORY flag (or enumMEMT.INVENTORY) to trigger parameter to access to inventory memory. Example: // supposing the trigger parameter was in Timer variable Value = ReadMemVariable(Timer | enumMEMT.INVENTORY); // or, to change a inventory value: // if we want set 0 in mem inventory variable in Timer WriteMemVariable(Timer | MEMT_INVENTORY, 0); Note: remember that all operations on inventory memory will work with a, previously set, current inventory record. You can read the current inventory record index in this way: Get(enumGET.VARIABLES,0,0); Index = * GET.Vars.pMemorySelected->pIventorySelected; Or set its value (setting a new inventory index) in this way: Get(enumGET.VARIABLES,0,0); * GET.Vars.pMemorySelected->pIventorySelected = 14; Note: the call to set data in GET.Vars: Get(enumGET.VARIABLES,0,0); It could be executed only once, in cbInitLevel() function, and it will grant to have valid values in GET.Vars structure in all following elaborations, from other functions. |
Savegame Memory |
#MEMORY_SAVE# preset trigger argument Example of this list: F244 trigger, extra timer field |
enumMEMT.SAVEGAME |
You add the MEMT_SAVEGAME flag (or enumMEMT.SAVEGAME) to trigger parameter to access to savegame memory. Example: // supposing the trigger parameter was in Timer variable Value = ReadMemVariable(Timer | enumMEMT.SAVEGAME); // or, to change a value in savegame, setting -1 value WriteMemVAriable(Timer | MEMT_SAVEGAME, -1); |
Code Memory |
#MEMORY_CODE# preset trigger parameter Example of this list: F277 trigger, tiemer field |
enumMEMT.CODE |
You add the MEMT_CODE flag (or enumMEMT.CODE) to trigger parameter to access to code memory. Example: // supposing the trigger parameter was in ExtraTimer variable Value = ReadMemVariable(ExtraTimer | enumMEMT.CODE); // or, to change a value in some code field, setting 10 value WriteMemVAriable(ExtraTimer | MEMT_CODE, 10); |
Item Memory |
#MEMORY_ITEM# preset trigger argument Example of this list: F255 trigger, timer field |
enumMEMT.ITEM |
You add the MEMT_ITEM flag (or enumMEMT.ITEM) to trigger parameter to access to item memory. Example: // supposing the trigger parameter was in ExtraTimer variable Value = ReadMemVariable(ExtraTimer | enumMEMT.ITEM); // or, to change a value in item field, setting 0xfffe value WriteMemVAriable(ExtraTimer | enumMEMT.ITEM, 0xfffe); Note: remember that all operations on item memory will work with a, previously set, current index of some moveable item. You can read the currently selected moveable index in this way: Get(enumGET.VARIABLES,0,0); Index = * GET.Vars.pMemorySelected->pItemSelected; Or set its value (setting a new moveable index) in this way: Get(enumGET.VARIABLES,0,0); * GET.Vars.pMemorySelected->pItemSelected = ItemIndex; Note: the call to set data in GET.Vars: Get(enumGET.VARIABLES,0,0); It could be executed only once, in cbInitLevel() function, and it will grant to have valid values in GET.Vars structure, in all following elaborations, from other functions in same level. |
Slot Memory |
#MEMORY_SLOT# preset trigger argument Example of this list: F293 trigger, extra timer field |
enumMEMT.SLOT |
You add the MEMT_CODE flag (or enumMEMT.CODE) to trigger parameter to access to slot memory. Example: // supposing the trigger parameter was in ExtraTimer variable Value = ReadMemVariable(ExtraTimer | enumMEMT.SLOT); // or, to change a value in slot field, setting 0 value WriteMemVAriable(ExtraTimer | enumMEMT.SLOT, 0); Note: remember that all operations on slot memory will work with a, previously set, current slot structure. You can read the current slot index in this way: Get(enumGET.VARIABLES,0,0); Index = * GET.Vars.pMemorySelected->pSlotSelected; Or set its value (setting a new slot index) in this way: Get(enumGET.VARIABLES,0,0); * GET.Vars.pMemorySelected->pSlotSelected = 14; Note: the call to set data in GET.Vars: Get(enumGET.VARIABLES,0,0); It could be executed only once, in cbInitLevel() function, and it will grant to have valid values in GET.Vars structure in all following elaborations, from other functions. |
Animation Memory |
#MEMORY_ANIMATION# preset trigger argument Example of this list: F295 trigger, extra timer field |
enumMEMT.ANIMATION |
You add the MEMT_ANIMATION flag (or enumMEMT.ANIMATION flag) to trigger parameter to access to animation memory. Example: // supposing the trigger parameter was in Timer variable Value = ReadMemVariable(Timer | enumMEMT.ANIMATION); // or, to change a inventory value: // if we want set 0 in mem animation variable in Timer WriteMemVariable(Timer | MEMT_ANIMATION, 0); Note: remember that all operations on animation memory will work with a, previously set, current animation structure. You can read the current animation index in this way: Get(enumGET.VARIABLES,0,0); Index = * GET.Vars.pMemorySelected->pAnimationSelected; Or set its value (setting a new current animation index) in this way: Get(enumGET.VARIABLES,0,0); * GET.Vars.pMemorySelected->pAnimationSelected = AnimNow; Note: the call to set data in GET.Vars: Get(enumGET.VARIABLES,0,0); It could be executed only once, in cbInitLevel() function, and it will grant to have valid values in GET.Vars structure in all following elaborations, from other functions. |