Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
This question was closed Jul 22, 2014 at 09:54 PM by Graham-Dunnett for the following reason:

Duplicate Question - http://answers.unity3d.com/questions/topics/bce0051.html

avatar image
0
Question by masterer · Jul 22, 2014 at 09:54 PM · javascripterrorobjectarraysbce0051

When I try to compare an item in an array of Javascript objects I get this stubborn error: BCE0051: Operator '<=' cannot be used with a left hand side of type 'Object' and a right hand side of type 'int'.

Hi guys,

I am stumped about this Javascript "BCE0051: Operator '<=' cannot be used with a left hand side of type 'Object' and a right hand side of type 'int'" error I got. I'm working with both arrays and objects with keys and values. I have an array of such objects, and inside the objects beside the keys are int values. But apparently I don't have the right type to compare them on the right side.

Here's my code:

 var lessMore : int;
 var uglyBeautiful : int;
 var unableAble : int;
 var funnySerious : int;
 var unhealthyHealthy : int;
 var stupidSmart : int;
 var deadAlive :  int;
 var badGood : int;
 var painPleasure : int;
 var unusualUsual : int;
 var chaoticOrderly : int;
 var sameDifferent : int;
 var unimportantImportant : int;
 var nearFar : int;
 var shamePride : int;
 var smallGreat : int;
 var insideOutside : int;
 var unhappyHappy : int;
 var expectantSurprised : int;
 var nonexistExist : int;
 
 var verbIntrans = [{namer : "snow", lessMore : 2, uglyBeautiful : 9}, {namer : "swim", unableAble : 6, lessMore : 0}, {namer : "fart", uglyBeautiful : -9, lessMore : 0, funnySerious : -10, unhealthyHealthy : 7}, {namer : "think", lessMore : 0, stupidSmart : 10, deadAlive : 10, funnySerious : 0}, {namer : "blunder", badGood : -10, painPleasure : -9, stupidSmart : -10, chaoticOrderly : -10, funnySerious : 9}, {namer : "cook", badGood : 0, unusualUsual : 0, chaoticOrderly : 3}, {namer : "convulse", unhealthyHealthy : -10, badGood : -10, funnySerious : 10, painPleasure : -10, deadAlive : -7, unusualUsual : -7, chaoticOrderly : -9}, {namer : "cooperate", badGood : 1, lessMore : 0, chaoticOrderly : 3}, {namer : "die", sameDifferent : 10, badGood : -10, deadAlive : -10, unableAble : -10, painPleasure : -10, funnySerious : 10}, {namer : "diet", badGood : 3, stupidSmart : 2, unimportantImportant : 2}, {namer : "nod", funnySerious : -3}, {namer : "parody", sameDifferent : 4, painPleasure : 8, unusualUsual : -3, unimportantImportant : 0, funnySerious : -10}, {namer : "part", nearFar : 10}, {namer : "quack", shamePride : -7, stupidSmart : -7, lessMore : 0, unimportantImportant : -6, uglyBeautiful : -3, funnySerious : -8}, {namer : "recover", unhealthyHealthy : 10, badGood : 9, deadAlive : 10, lessMore : 0, unimportantImportant : 8}, {namer : "regrow", sameDifferent : 3, unhealthyHealthy : 6, badGood : 3, smallGreat : 9, unableAble : 6, lessMore : 0}, {namer : "rehearse", unableAble : 7, chaoticOrderly : 8}, {namer : "heal", unhealthyHealthy : 10, badGood : 9, painPleasure : 9, lessMore : 0, insideOutside : -5, unimportantImportant : 8}, {namer : "boast", shamePride : 6}];
 
 var ar=0;
         var myVerb = "";
         var aboutMyVerb=0;
         var verbIsNegative = false;
         var num=0;
         for(; num<verbTrans.length; num++){
             var arrVerb : Array = [];
             if(verbTrans[num]["badGood"] != null){
                 arrVerb.push(verbTrans[num]["badGood"]);
             }
             if(verbTrans[num]["smallGreat"] != null){
                 arrVerb.push(verbTrans[num]["smallGreat"]);
             }
             if(verbTrans[num]["nearFar"] != null){
                 arrVerb.push(verbTrans[num]["nearFar"]);
             }
             if(verbTrans[num]["deadaLive"] != null){
                 arrVerb.push(verbTrans[num]["deadAlive"]);
             }
             if(verbTrans[num]["unimportantImportant"] != null){
                 arrVerb.push(verbTrans[num]["unimportantImportant"]);
             }
             if(verbTrans[num]["lessMore"] != null){
                 arrVerb.push(verbTrans[num]["lessMore"]);
             }
             arrVerb = shuffle(arrVerb); //not showing shuffle function here unless it's needed to see
             var arb=0;
             if(arrVerb.length > 0) {
                 for(; arb<arrVerb.length; arb++){
                     if(arrVerb[arb] <= -5 || arrVerb[arb] > 5){
                         verbIsNegative=true;
                         myVerb=verbTrans[num]["namer"];
                         aboutMyVerb=arrVerb[arb];
                         break;
                     }
                     else {
                         myVerb="get";
                     }
                     break;
                 }
             }
         }
 
Comment
Comments Locked
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

0 Replies

  • Sort: 

Follow this Question

Answers Answers and Comments

2 People are following this question.

avatar image avatar image

Related Questions

how to save an array into an object 1 Answer

Using arrays and for loop with GetComponent error 1 Answer

How do I change the text of a gui image text 1 Answer

Getting "UnityEngine.GameObject.enabled' not found error 1 Answer

I'm working on a mouse look script but it isn't working. Help? 1 Answer


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges