![]() |
Object transfering
I've heard of this problem before but I've never actually had to deal with this before until now; I have a mudlib that I'm creating and I'm having problems transferring the info from the server to the client.
I've tried a couple ways to get around this: setting the object as a player.attr which didn't work. I've tried saving the object vars to an array and transfering the array, but for some reason that didn't work either, maybe it was something wrong with my coding. This is my function which returns a player's mud file: PHP Code:
PHP Code:
PHP Code:
|
PHP Code:
|
I would stick to loadvars()/savevars() and loadvarsfromarray()/savevarstoarray(), not using those getdynamicvarnames() stuff, like ziro said.
Your code also contains a lot of undefined stuff (temp.playeritems, temp.itemxfer are never assigned a value) so it's not easy to help |
It seems to be a problem with the savevarstoarray command.
PHP Code:
PHP Code:
|
Quote:
Variables are saved to array like {"varname=value", "varname2=value"} meaning its a string and if the value can't be represented as a string its not going to work. Perhaps if it did {{varname, value}, {varname2, value2}} instead that would be possible as long as you didn't convert array to string, but you still can't send objects to client. I never use savevarstoarray() for sending item data to client because that means the amount of data sent would be a lot larger than it needs to be. I put it in a format like: {{varname1, varname2}, {value1, value2}, {value1-2, value2-2}, {value1-3, value2-3}} When the data gets to client new objects are created. Here is code snippet from Inventory: PHP Code:
|
Yeah. That's why my first attempt was to use getdynamicvarnames to save the subvariables of each item but I'm still not sure why that isn't working.
Ohh that helps I see how I can get it to the client now. I like the idea of defining player.mud better then what I did also ^^ |
| All times are GMT +2. The time now is 09:41 PM. |
Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2026, vBulletin Solutions Inc.
Copyright (C) 1998-2019 Toonslab All Rights Reserved.