Ary Endleg Posted April 25, 2014 Report Posted April 25, 2014 I've been reading around and there are stuff I can't find explained enough or I just don't understand them, mostly it's case two, so here are some questions. @input stores just the input of "rpc-keyword" (standard input field on all clickables) or does it store variables for customly created forms too? If so... I'm not quite sure how to fetch all those data. But I assume @input[0] is rpc-keyword while all sequential vars in array would be those of custom form in same order? What is the limit on variable size, how many char? I kind of need to know if I plan to have users input possibly large texts. What is difference between @store and @storage? In few places I see @store mentioned but other than that not much about it... What does it mean that storage needs to be remotely accessed in order to be used for another editor and how it is done? Quote
rikstar Posted April 25, 2014 Report Posted April 25, 2014 http://magicduel.invisionzone.com/topic/5494-variables/ ^^ "3 special variables @input , this will get filled automaticaly with anything sent from a FORM (user input!)@content, this is an array that hold each of the content sections that you separate by the content separator in the content editing field, the other field besides the script editing field.@storage, gets loaded with data by the mds_storage() function. All data in this array gets saved to the database as a storage. Set data in the right indexes and after initiating storage or your script will get warnings if you set this var chaoticaly. " So @input will save all variables that are sent via forms and buttons. I think that @store and @retrieve aren't used that commenly nowadays. I would suggest to save variables via @storage. @va=mds_storage("???","aoau"); @temp = @storage[@va][uv("name")]; First use the mds_storage("storage_name", "storage_type") function to get the ID of your storage. Then use @storage[@va][uv("name")] to get all the variable that is saved under the "uv("name")" with your storage ID.The function uv("name") returns the player's name that is using that clickie. This saving technique is used when you want every player to store their own variables. Change @temp and save your variable this way: @storage[@va][uv("name")] = @temp; When you want to save a lot of variables for every player then make an array and save that array. This can be done this way: @temp = array("name"=>uv("name"), "stage"=>0, "win"=>0, "lost"=>0); Then save that array this way: @storage[@va][uv("name")] = @temp; To retrieve the array just use this again: @va=mds_storage("???","aoau"); @temp = @storage[@va][uv("name")]; To get the name of the player use: @temp["name"] or to get the win variable: @temp["win"]; If you have any question regarding this post, then don't mind to ask them. Quote
Root Admin Chewett Posted April 25, 2014 Root Admin Report Posted April 25, 2014 Yes we do not recommend using @Store, its likely to be phased out in the future. Quote
Ary Endleg Posted April 25, 2014 Author Report Posted April 25, 2014 Yes I read all forum and wikias before I posted this questions so copy pasting me information from those places won't do any good. So @input will save all variables that are sent via forms and buttons. And they are fetched in a way I assumed in original post? Can I get examples for this? I understand storage, was just wondering about store. Since Chewett says it's unrecommended and to-be-removed, looks like I won't be needing answers regarding it. Still wondering about variable size. What about storage for another editor that needs to be remotely accessed? I somehow feel it is explained to me but that different terminology is the barrier. I assume that "another editor" is another clickable object that uses same storage as the first clicky and that "remote access" is just opening the storage normally with mds_storage(id,type)? Quote
rikstar Posted April 25, 2014 Report Posted April 25, 2014 (edited) I will answer the @input question later, it should be findable on the forums. But I'll give an explanation later. When I have some more time. Everything saved via storage and retrieved from storage and mds_storage can be accesed via every clickable. In exactly the same way you did in a previous clickable script. You can even edit variables from other players, if I'm correct. Though you must know the ID from that storage. I don't know anything of the variable size, but I suspect that you can save a lot. So you won't run into problems like that. Edited April 25, 2014 by rikstar Quote
Ary Endleg Posted April 25, 2014 Author Report Posted April 25, 2014 I don't think that you could edit variables from other players if you know their id.... makes no sense. If storages are realm wide and cross-coder then name collision is pretty much guaranteed. If you name your storage alpha and I name mine storage alpha too, one would overwrite the another. Quote
rikstar Posted April 25, 2014 Report Posted April 25, 2014 Yes you overwrite them, but you could also edit them. Just check what kind of array it is and your in. But having a unique storage name doesn't give that oppertunity to other players. It's a good thing to make sure that nobody knows the name of your storage. Quote
Root Admin Chewett Posted April 26, 2014 Root Admin Report Posted April 26, 2014 I don't think that you could edit variables from other players if you know their id.... makes no sense. If storages are realm wide and cross-coder then name collision is pretty much guaranteed. If you name your storage alpha and I name mine storage alpha too, one would overwrite the another.It is recommended to use storage names that are likely to be not used.The recommended practice is naming them:{playername}_{random number}_{storage_name}so no one can try and guess what storages you are using. Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.