2021-04-23: Temp Variables
Sometimes you need a variable for a fraction of a second (or just a few expressions). YSI has 3 of these ?temp? variables already to avoid creating more:I@, J@, and Q@[YSI_MAX_STRING].
These variables can NOT be relied upon over function calls, so this might not work:
GetSomeData might modify J@ and you would never know. These are purely for getting some data then using it pretty much straight away.
There is also another one of these short variables: @_ (yes, the variable is called <at><underscore>). This is the Master ID for a script. All currently running scripts have an ID.
Sometimes you need a variable for a fraction of a second (or just a few expressions). YSI has 3 of these ?temp? variables already to avoid creating more:I@, J@, and Q@[YSI_MAX_STRING].
Quote:
#define ReturnPlayerHealth(%0) (GetPlayerHealth((%0), Float:I@), Float:I@)
Quote:
#define ReturnPlayerName(%0) (GetPlayerName((%0), Q@, 24), Q@)
These variables can NOT be relied upon over function calls, so this might not work:
Quote:
J@ = j;
GetSomeData();
printf("%d", J@);
GetSomeData might modify J@ and you would never know. These are purely for getting some data then using it pretty much straight away.
There is also another one of these short variables: @_ (yes, the variable is called <at><underscore>). This is the Master ID for a script. All currently running scripts have an ID.