Hello again,
I've been trying to filter random result using SearchCustomData but it still returns weird results. If I set the operation to "disequals" then I get correct responses but "equals" never returns anything.
I've logged what I'm sending to make sure my search is correct: "Level Equals 6"
What could be the problem? I know the level is correctly stored, i can view it in the admin panel. Any ideas?
lallySearchFilters [i] = new SearchCustomData ("Level", eSearchOperator.Equals, range.ToString ());
Combu.User.Random <User> (allySearchFilters, 5, OnRandomUsersLoaded);
Also, is there a way to update multiple inventory items at once? currently i loop through and update each individually.
No there isn't a shortcut currently, usually you made changes on one item at time.
About your issue I'm in vacation till August 24th, so I'm sorry but any support will be delayed till that date. I'll check it out as soon as will come back.
FRANCESCO CROCETTI @ SKARED CREATIONS
I'm doing a crafting system and i want to remove several items at once, it has to send multiple times and if the connection drops, the person may lose 1 item while not getting their new item because the process was incomplete.
The 24th is pretty far away, I'd hate to tell my client that he has to wait that long. I don't want to seem pressuring but If there's anything you think I could be doing wrong or anything you can suggest before such a date, it would be highly appreciated.
Unfortunately I'm away from office and without a PC till that date, so I cannot check your issue. About your request for multiple items update I will eventually add this feature myself when will come back, for now if you're experienced with PHP you could do it yourself in a new webservice: I would do it by passing a JSON serialized string with items info and do similarly to action save of Inventory item.
FRANCESCO CROCETTI @ SKARED CREATIONS
Fine, I understand.
Another question, why does the data from serverInfo.time differ from CombuManager.localUser.lastSeen, as if they use different timezones?
I've left the DEFAULT_TIMEZONE commented out also.
I am also trying to solve these myself but I'm just really getting into PHP so I am not well versed.
Please disregard the last message about time. I managed to learn a few stuff in PHP and was able to solve my issue.
So right now, I would just like some help with the SearchCustomData, this is setting us back alot.
Hi,
I tried customData filtering with User.Random with the following code and it worked (I had an account with "Level" customData set to "6"):
User.Random(new SearchCustomData[] { search }, 10, (User[] users) => {
Debug.Log(users.Length);
if (users.Length > 0)
Debug.Log(users[0].userName);
});
About the timezone, if you don't set DEFAULT_TIMEZONE then all datetime values (including lastSeen and scores) are saved with the timezone of your server, which should be fine for most cases. For more accurate settings you may want to set the property timezone of CombuManager at runtime from the platform system, it must be a valid string from the list that you find at http://www.php.net/manual/en/timezones.php
You can also change the method CombuManager.CallWebservice with this one (it will be added to next update anyway) to send the Timezone parameter to all calls:
{
if (!string.IsNullOrEmpty(timezone))
form.AddField("Timezone", timezone);
StartCoroutine(DownloadUrl(url, form, onComplete));
}
FRANCESCO CROCETTI @ SKARED CREATIONS
Okay, you are right, it does work if I just do:
new SearchCustomData ("Level", eSearchOperator.Equals, "2");
But if it doesnt work, if I do (which I need to since the value will change):
int range = 2;
new SearchCustomData ("Level", eSearchOperator.Equals, range.ToString());
I find this pretty strange, I don't think its an issue with your plugin but any help would be useful.
Really don't know, it works for me even if I declare an int variable and pass ToString() to the constructor as it should. Print the value of range before passing to the constructor to be sure it's what you're expecting to be.
FRANCESCO CROCETTI @ SKARED CREATIONS
I think it might be something wrong with this:
for (int i=0; i<5; i++) {
allySearchFilters [i] = new SearchCustomData ("Level", eSearchOperator.Equals, range.ToString ());
range += 1;
}Combu.User.Random <User> (allySearchFilters , 5, OnRandomUsersLoaded);
Because when this works:
SearchCustomData search = new SearchCustomData ("Level", eSearchOperator.Equals, range.ToString ());
Combu.User.Random <User> (new SearchCustomData[] { search }, 5, OnRandomUsersLoaded);
I think I have a workaround now though, thanks for the effort.
Okay, I think I found the issue. I'm trying to return users of level between a certain range but it seems If It doesn't allow multiple values of the same key in one search.
This works:
for (int i=0; i<5; i++) {
allySearchFilters [i] = new SearchCustomData ("Level", eSearchOperator.Equals, range.ToString());
//range += 1;
}
Combu.User.Random <User> (allySearchFilters, 5, OnRandomUsersLoaded);
This doesnt work:
for (int i=0; i<5; i++) {
allySearchFilters [i] = new SearchCustomData ("Level", eSearchOperator.Equals, range.ToString());
range += 1;
}
Combu.User.Random <User> (allySearchFilters, 5, OnRandomUsersLoaded);
Oh I see, if you wanted to search a range than you should pass an array of two SearchCustomData items: one with eSearchOperator.GreaterOrEquals the lowest range and one with eSearchOperator.LowerOrEquals the highest range. With your previous code the search couldn't work because the search filters are concatenated with "AND" so they must be all valid for every account (so you were basically looking for players who have "Level" 1 and 2 and 3 etc., not in a range).
FRANCESCO CROCETTI @ SKARED CREATIONS
Oh my. Thank you. I didn't think of that.
I highly appreciate the help.
Sorry for bring this back up but, could you give me a code snippet of this working or atleast test and inform me one what I am doing wrong?
I've tried several solutions and I still seem to get weird results, the last thing i tried was:
allySearchFilters [0] = new SearchCustomData ("Level", eSearchOperator.Greater, "0");
allySearchFilters [1] = new SearchCustomData ("Level", eSearchOperator.Lower, "5");
Combu.User.Random (allySearchFilters, 5, OnRandomUsersLoaded);
With this, I still see some weird levels returning, even 20+