![]() |
Objects ...
Basicly, I do
this.messages.cbk1994 = { "blah", "blah2", "blah3" }; then I have this.messages.cbk1994.blah = "variable here"; then echo( this.messages.cbk1994.blah ); Nothing echoes. What am I doing wrong? (Yes I suck at objects :C) |
Right, in this case, "blah" is part 0 of the array, "blah2" is part 1 of the array, etc. Therefore, to overwrite "blah", you do this.messages.cbk1994[0] = "new value", and likewise to overwrite "blah3", this.messages.cbk1993[2] = "new value".
|
function onCreated()
{ this.messages.loadVars( this.lasts ); findPlayer( "cbk1994" ).chat = this.messages.cbk1994; } basically what happens. I use a script to remove all variables of this.messages. It loads the variables correctly. (In DB-NPC flags it shows them correctly). The variable this.messages.cbk1994 should have a value, but it sets my chat to '0'. -EDIT- Apparently the problem is that it is an array ... if I change the array to a string it works fine ... why won't the array work, how can I get it to? Thanks. -EDIT AGAIN- I can't this.messages.cbk1994 = ""; this.messages.cbk1994.clear(); How can I erase it? It is equal to ... messages.cbk1994=s_cbk1994_20, direct from the DB NPC |
I don't see why you'd want to use loadvars in this scenario.
HTML Code:
public function onretrieveMessages(playerAccount)HTML Code:
msg_Chandler="Hiya, how're you?", "Today I have a message" |
Quote:
|
Quote:
|
I have added a few days ago a new function for deleting sub-variables: obj.clearVars(). It is not uploaded to all machines yet though.
|
Skyld came on and fixed my code.
<3 Skyld |
| All times are GMT +2. The time now is 08:10 PM. |
Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2026, vBulletin Solutions Inc.
Copyright (C) 1998-2019 Toonslab All Rights Reserved.