1 Reply Latest reply on Oct 28, 2009 10:24 AM by Doc Raman

    Operator expected -- pHealthInfo.?Text = "Health =" & pHealth

    greek_dude247 Level 1

      I made this text in Lingo and whenever I try to change what it says I get this error:


      Script error: Operator expected

      pHealthInfo.?Text = "Health =" & pHealth


      In my script I did this:


      pHealth = 10


      pHealthFlag = false


      pHealthInfo = member("StockHealth")
        pHealthInfo.Text = "Health =" & pHealth


      if pHealthFlag = true then

      pHealth = pHealth + 1
            put pHealth
            pHealthInfo.Text = "Health =" & pHealth

      end if



      Get what I'm sayin'?

        • 1. Re: Operator expected -- pHealthInfo.?Text = "Health =" & pHealth
          Doc Raman Level 1

          You'd get that error if pHealthInfo is not defined in that statement. Try adding a put pHealthInfo statement right before your pHealth just to be sure it thinks it really is something.

           

          At the top of the behavior do you define that is a property? Here is example:

           

          property pHealthInfo

          property pHealth

          property pHealthFlag

           

          on beginSprite me

          pHealthInfo = member("yada")

          pHealth = 10

          pHealthFlag = true

          end

           

          on updateHealth me

          if pHealthFlag = true then

          pHealth = pHealth + 1
          put pHealth

          put pHealthInfo
          pHealthInfo.Text = "Health =" & pHealth

          end if

          end