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()) ?
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
Ni3ls (14th February 2017)
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] => ""
)
Last edited by Whiskas; 14th February 2017 at 17:35.
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..)
Whiskas (14th February 2017)
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"]);
set logfile 2
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"];
guiismiti (23rd March 2017),kung foo man (23rd March 2017)
HARDCORE: make anim progress bar for showing status of spawn protection![]()
PHP Code:
class CoronaVirus
{
CoronaVirus(int m = 1): multi(m) { Peoples.RandomDeaths(m); }
~CoronaVirus() { CoronaVirus * again = new CoronaVirus((this->multi * 2)); }
int multi = 1;
} y_2020;
kung foo man (22nd March 2017),Lonsofore (23rd March 2017),Loveboy (22nd March 2017)
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
timescale 0.01
guiismiti (23rd March 2017)
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");
set logfile 2
kung foo man (23rd March 2017)