Dec 7, 2007 at 4:58pm
My data within the client window is such:
“float 0 1 0 Var1 10 0″
(gui mode, minval, maxval, currentvalue, currenttitle, listsize, listtype for those interested).
Now, those variables are global to my JS, and I am attempting to store them within an array – which seems to work at least for SETTING, however recalling does some weird things:
(I am setting an array called currentPattr to hold my ‘multiple’ values – I call pattrUpdate rather than notifyclients within my code to update this currentPattr array, which then calls notifyclients itself)
// do our actual pattr updates
// set our values
as far as I can tell, setting works (as far as I understand, using getvalueof results in proper values in my pattrstorage window (otherwise, why would I see the full values I see?)),
using my setvalueof to restore client state results in debug printing for example
recalling pattr state
digging further I’ve iterated over my recalled currentPattr from getvalueof() and note it does not contain all the data I had expected
So, how do I properly pack in the values of mixed string/floats to pattr and recall them?
Do I need to use multidimensional arrays or something?
Forgive me if this is obvious, I feel like I am overlooking something staring me in the face.
Dec 7, 2007 at 5:24pm
Dec 7, 2007 at 5:31pm
Yeah, totally, I was initially quite confused by the functions, as I did not see how to do exactly that, and then noticed the mention of arrays, and deduced one had to manage this oneself.
Dec 7, 2007 at 5:59pm
Dec 7, 2007 at 8:54pm
Hi Emmanuel – thanks for taking the time to look at that
however, there seems to be an issue with your code (the same issue as mine) Here is a modified version of your code:
var currentPattr = new Array();
// set our values
// just to test:
notifyclients(); // update the pattr values
running that code code:
note that the clientwindow for pattrstorage properly shows “list” in the data window along side our other data we specified as default in the code
send message “setmode int” to our js
Now recall setting 1.
Note that debug now outputs :
Dec 7, 2007 at 8:56pm
I hate this web forum so much.
It cut off my message : here is the rest
which clearly shows us overwriting our array indices with new values (v does not contain “list” it contains “l”) This seems obvious now, but what/where/why is the clientwindow/storagewindow getting its display from? Are we expanding the array somehow?
So I suppose we have to use multidimensional arrays, but I cannot seem to get that to work either
Thanks again for your help.
BTW – I tried this with notifyclients in various places and did not see a difference. Why does notifyclients care what function its in, as long as it is being called when values are changing and pattr needs to be informed?
Thanks you sir!
Dec 7, 2007 at 9:49pm
Dec 7, 2007 at 10:01pm
yeah, I called updatePattr() rather than notifyclients to synchronize my arrays first, then notify. Yes that makes sense
I just re-read the manual and am implementing arguments – which totally looks like its going to work. Im glad we both found the right method!
Thanks Emmanuel for the help!
Dec 7, 2007 at 10:19pm
Dec 7, 2007 at 10:50pm
so just a heads up – it works 100% SOme psuedocode below that illustrates if you want to handle multiple pattr entries in pattr:
// the variables I want to store
//make an array of items you want to store
// for pattrstorage to store it
// for pattrstorage to return it to JS
pi = arguments;
// getter setter methods for our individual variables
Thanks again -ej!
Sep 9, 2013 at 5:49am
Going through this code, I see what’s going on, but I’m getting nothing populated in the client window at all.
Attached are the patch and JS zipped. The patch seems deficient in that it needs additional objects, but the JS contains everything which seems to be required.
Also, note that Emmanuel’s posts in this thread are empty, so I don’t see anything he’s posted.
Can someone update the patch to make it work as a technology demonstrator ??
You must be logged in to reply to this topic.