CLEO5 Script for GTA SA Pool Info
CLEO5 Script for GTA SA Pool Info
The script uses the function `GET_POOL_INFO`, which reads the memory address of a pool to determine its size and the number of elements currently used. For pools that exceed the set `Pool_Size_Cap`, only the capped size is processed. It calculates the number of occupied slots by iterating over a byte map that flags whether each slot is empty or not, incrementing a count for each occupied slot. These values are then displayed using the `DRAW_COUNT_LINE` function .
The graphical position for displaying pool information is managed through a float variable `pos`. Initial position is set to a specific value (120.0 in this case), and as each pool's information is drawn, the position is updated by the `DRAW_COUNT_LINE` function, which increments the position by 10.0 after drawing each line of text, ensuring that the displayed information appears sequentially on the screen without overlap .
The `TERMINATE_THIS_SCRIPT` command is used to stop the execution of the script. Within this script's context, it serves as an endpoint, effectively ceasing all operations specified in the script after execution conditions are fulfilled or when it's no longer necessary to run the script, ensuring resources are not wasted on unnecessary processes .
The `processSize` variable is utilized to determine the number of slots to iterate over, capping it to `Pool_Size_Cap` when the pool size exceeds this limit. This variable ensures the script does not exceed handling an excessive number of elements, which could degrade performance. By limiting the iteration size, it effectively prevents unnecessary processing overhead associated with large pools, aiding in maintaining script efficiency and responsiveness .
When handling pool sizes larger than the preset capacity (`Pool_Size_Cap`), the script caps the processing size to the limit instead of iterating over every element. This decision is important for performance reasons, as iterating through a very large number of pool elements could cause significant slowdowns. By limiting the processing to only manageable chunks, the script maintains efficiency without overloading the system .
The script toggles the active state of displaying limits information based on the detection of a specific cheat code 'limits'. Initially, the script continuously checks if the cheat has been activated, toggling the `active` variable between true and false each time the cheat is detected. This toggle enables or disables the on-screen display depending on the state, with the script waiting to update until the next detection .
The script uses color coding to visually indicate pool usage, transitioning from green to red based on the ratio of used to total slots. The function `SET_TEXT_COLOR` blends colors, turning the text green when usage is low, orange at medium usage, and red when nearly full. This is achieved by adjusting RGB values based on the usage ratio, which are then set for the on-screen display text color .
Large pool sizes can significantly impact performance in script loops due to the necessity to iterate over all elements, which can be computationally expensive. The script proposes a solution by drawing stats on every frame from variables and updating these stats by processing pools only once every few seconds, instead of continuously iterating through all elements of larger pools. This approach helps in reducing the performance hit associated with large pool sizes .
The `DRAW_MISSION_CLEANUP_LIST_INFO` function reads the current count and maximum size of mission cleanup entries from memory, and displays this information on the screen. Its purpose is to provide visual feedback on mission cleanup status, allowing the user to monitor how many cleanup entries are active compared to the limit. This contributes to the script's functionality by offering real-time update capabilities of critical game data during script execution .
The script determines if a pool slot is empty or occupied by evaluating each slot's flags stored in the byte map using the `is_local_var_bit_set_const` function. This checks whether the specific flag `bEmpty` is set or not for each slot. The count of occupied slots is incremented for each non-empty slot. This mechanism plays a crucial role in assessing pool usage stats by accurately determining the number of active slots compared to the pool's total capacity .