Jump to content

Problem with llJsonGetValue - after 3 use


SirMacMoneysack
 Share

You are about to reply to a thread that has been inactive for 2895 days.

Please take a moment to consider if this thread is worth bumping.

Recommended Posts

Hi i work on a project in this project i have to access a JSON DB with the same Searchparameters, the first 2 searches work fine, but the 3. one fails - the values are the same all times

 

Thats the script i use :

 

string auswertung(string mmsg)
{
 integer i=0;
 string  temp="?";
 string aktMp="";
 do
 {
  aktMp=aktM+(string)i;
  temp=llJsonGetValue(db,[aktMp,"name"]);
  if(temp==JSON_INVALID)     // only for debug
      llWhisper(0,"JSON_INVALID");  // only for debug
  if(temp!=JSON_INVALID)
   {
    if(temp==mmsg)
    return llJsonGetValue(db,[aktMp,"antwort"]);   
   }   
  ++i;
 }   
 while(i<=12);  // Max Entry in DB per use
 return NOTF;
}

 

thats the values i use to start the script:

 

mmsg = "Pause +"

aktM="H1"

NOTF="DSNF"

db={"H112":{"name":"ENDE","antwort":"ende"},"H110":{"name":"SAVE","antwort":"Okay"},"H11":{"name":"Pause +","antwort":"P+"},"H13":{"name":"Pause -","antwort":"P-"},"H14":{"name":"Rahmen -","antwort":"1010"},"H15":{"name":"Reset","antwort":"1012"},"H16":{"name":"Rahmen +","antwort":"1011"},"H17":{"name":"Farbe","antwort":"1019"},"":{"name":"P+","antwort":""},"":{"name":"P+","antwort":""}}

 

i checked all values doubble but cant see the problem, everytime i call this script - if works 2 times fine then it returns only JSON_INVALID until i reset it - then it works fine agin 2 times and the problem is back

please tell me whats wrong with this code?

Link to comment
Share on other sites

tx for this link - but i know this source of information and use it to build this script  but there is no Information about this kind of problems  and its a Part of LSL Scripting, so  i am right here i think.

But if you know a JSON Forum here - i will try my luck there -

Link to comment
Share on other sites

tx for this link - but i know this source of information and use it to build this script  but there is no Information about this kind of problems  and its a Part of LSL Scripting, so  i am right here i think.

But if you know a JSON Forum here - i will try my luck there -

Link to comment
Share on other sites

undefined json name in the json string returns unpredicatable results. I made a test out of your script to show this. If uncomment the undefined records then will get undefined (unpredictable) returns 

 

string NOTF = "DSNF";string db;string aktM;string auswertung(string mmsg){  integer i = 0;  string  temp = "?";  string aktMp = "";  do  {    aktMp = aktM + (string)i;    temp = llJsonGetValue(db,[aktMp,"name"]);    //if (temp == JSON_INVALID)       // only for debug    //   llWhisper(0, "JSON_INVALID"); // only for debug    if (temp != JSON_INVALID)       return llJsonGetValue(db,[aktMp,"antwort"]);           ++i;  } while(i <= 12);  // Max Entry in DB per use  return NOTF;}default{    touch_start(integer total_number)    {        db = "{"             + "\"H112\":{\"name\":\"ENDE\",\"antwort\":\"ende\"},"             + "\"H110\":{\"name\":\"SAVE\",\"antwort\":\"Okay\"},"            + "\"H11\":{\"name\":\"P​ause+\",\"antwort\":\"P+\"},"            + "\"H13\":{\"name\":\"Pause -\",\"antwort\":\"P-\"},"            + "\"H14\":{\"name\":\"Rahmen -\",\"antwort\":\"1010\"},"            + "\"H15\":{\"name\":\"Reset\",\"antwor​t\":\"1012\"},"            + "\"H16\":{\"name\":\"Rahmen +\",\"antwort\":\"1011\"},"            + "\"H17\":{\"name\":\"Farbe\",\"antwor​t\":\"1019\"}"            //+ "\"\":{\"name\":\"P+\",\"antwort\":\"\"},"   // undefined json name            //+ "\"\":{\"name​\":\"P+\",\"antwort\":\"\"}"    // returns unpredictable results            + "}";                aktM = "H1";                string m = "Pause +";        integer i;        llOwnerSay("begin...");                for (i = 1; i <= 4; i++)        {            string r = auswertung(m);            llOwnerSay®;            }          llOwnerSay("...end");    }}
Link to comment
Share on other sites

oh sometimes will not see the woods too mutch trees - this undef. JSON is a multfunktion of the script that calls this one - sorry dont reg the problem - so think if i fixed the propblem - it will work fine - tx for this push of my nose to this fact.

 

 

Link to comment
Share on other sites

You are about to reply to a thread that has been inactive for 2895 days.

Please take a moment to consider if this thread is worth bumping.

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
 Share

×
×
  • Create New...