Is there a way to print/display a structure of an object (self, level etc.) like it is made for example in PHP (vardump()/print_r()) ?
Printable View
Is there a way to print/display a structure of an object (self, level etc.) like it is made for example in PHP (vardump()/print_r()) ?
Not directly: https://killtube.org/showthread.php?...5105#post15105
I believe that you misunderstood my question. For example: I used "magic function" on player object and I would like to get back something like this:
But with every variable that is "binded" to that structure. I would like to know what variables does level/player have.PHP Code:
Object (
[name] => "Whiskas"
[pers] => Array
(
[team] => "spectator"
[weapon] => undefinded
[savedmodel] => undefined
[skipserverinfo] => undefined
)
[score] => 6
[death] => 2
[sessionstate] => "playing"
[maxhealth] => 100
[health] => 100
[friendlydamage] => undefined
[statusicon] => ""
)
Ahh, got it
iirc libcod also has GetArrayKeys() implemented, that works like the CoD4 version (see script reference for that) but this would work only for arrays, not objects..)
How can I print a precached string?
I have this on Callback_StartGameType()
And I'm trying to print it like thisCode:game["spawnprotection"] = &"^2Spawn protection ^1OFF^7";
precacheString(game["spawnprotection"]);
Code:self iprintln(game["spawnprotection"]);
In iprintln you can use only simple strings (like str="string").
And as I know, strings with & (don't know a real name of this strings. somebody tell me, please) you can only precache and use for HUDs.
So, you can:
1. Make a simple string and use iprintln:
2. Make a HUD with your precached string:Code:game["spawnprotection"] = "^2Spawn protection ^1OFF^7";
self iprintln(game["spawnprotection"]);
Code:game["spawnprotection"] = &"^2Spawn protection ^1OFF^7";
precacheString(game["spawnprotection"]);
self.hud = newClientHudElem(self);
self.hud.x = x;
self.hud.y = y;
self.hud.label = game["spawnprotection"];
HARDCORE: make anim progress bar for showing status of spawn protection;)
You could refer to them as "configstring strings" or "precached strings" (sic) ^^
guiismiti:
Basically you need to track yourself which values your precached strings have. IzNoGoD compiled this post with basically all info's: https://killtube.org/showthread.php?...out-precaching
I actually solved my problem.
All I wanted was to avoid the localized string warning in the console, so I created a localized string (didn't know how to do it, I thought I only needed to precache a string).
So, for people with the same doubt:
Create a .str file in folder localizedstrings;
Write your strings:
Print it like this (where FILENAME is the name of the .str file you created):Code:REFERENCE WELCOME_MESSAGE
LANG_ENGLISH "^2Welcome to the battlefield"
LANG_GERMAN "#same"
LANG_RUSSIAN "#same"
REFERENCE SPAWN_PROTECTION_OFF
LANG_ENGLISH "^2Spawn protection ^1OFF^7"
LANG_GERMAN "#same"
LANG_RUSSIAN "#same"
ENDMARKER
Code:player iprintln(&"FILENAME_SPAWN_PROTECTION_OFF");