Hosting and domain costs until October 2024 have been generously sponsored by dumptruck_ds. Thank you!
Difference between revisions of "objerror"
From Quake Wiki
Line 1: | Line 1: | ||
− | + | ''void'' '''objerror'''(''string'' message) | |
− | |||
− | + | == Usage == | |
− | + | Throws an error related to the current '''self''' entity. Information about this entity is dumped in the console. This entity is also removed and execution of its code will stop. This should be used for culling improperly set up entities or ones that enter invalid states. | |
− | |||
− | |||
− | |||
+ | === Parameters === | ||
+ | *''message'' | ||
+ | :The message to display alongside the entity information dump in the console. | ||
+ | |||
+ | == Example == | ||
+ | // This entity assumes it will have a valid target id | ||
+ | // If not, it removes itself with an error | ||
+ | void func_my_entity() | ||
+ | { | ||
+ | if (!self.target) | ||
+ | objerror("my_entity was not given a valid target id\n"); | ||
+ | |||
+ | // ... | ||
+ | } | ||
[[Category:QuakeC Function]] | [[Category:QuakeC Function]] |
Revision as of 12:13, 31 July 2023
void objerror(string message)
Usage
Throws an error related to the current self entity. Information about this entity is dumped in the console. This entity is also removed and execution of its code will stop. This should be used for culling improperly set up entities or ones that enter invalid states.
Parameters
- message
- The message to display alongside the entity information dump in the console.
Example
// This entity assumes it will have a valid target id // If not, it removes itself with an error void func_my_entity() { if (!self.target) objerror("my_entity was not given a valid target id\n"); // ... }