So, I thought the object might have a maxchars variable to limit the amount of characters typed but apparently it doesn't. Anyhoo,
PHP Code:
function onActionServerSide() {
if (params[0] == "changenick") {
player.nick = params[1];
player.chat = "Your nick has been changed";
}
}
//#CLIENTSIDE
function onCreated() {
if (test_window != NULL) test_window.destroy();
new GuiWindowCtrl("test_window") {
profile = GuiBlueWindowProfile;
resize(1,1,200,100);
text = "blah";
new GuiTextEditCtrl("nicknametext") {
profile = GuiBlueTextEditProfile;
resize(10,45,160,30);
text = "Type here!";
}
}
//onDebug(nicknametext);
}
function nicknametext.onMouseDown() {
if (!nicknametext.clickedonce) {
nicknametext.text = "";
nicknametext.clickedonce = true;
}
}
function nicknametext.onTextChanged() {
if (nicknametext.text.length() > 10)
nicknametext.text = nicknametext.text.substring(0,10);
}
function nicknametext.onAction()
triggerserver("gui", this.name, "changenick", nicknametext.text);
/* Debug method
Press f2 after calling this function */
function onDebug(obj) {
say2("Press f2 to read output!");
echo("\nFUNCTIONS");
for (f : obj.getfunctions())
echo(f);
echo("\nVARIABLES");
for (f : obj.getvarnames())
printf("%s=%s", f, obj.(@f));
echo("\nPROFILE VARS");
for (f: obj.profile.getvarnames())
printf("%s=%s", f, obj.profile.(@f));
}
If you uncomment the onDebug() line, you can run that script then press F2 in game and it will show you all the functions/variables available for that object which can be useful to determine what the object is capable of. Can change it to onDebug(test_window) or even onDebug(player) to see the different functions/variables for objects
