Graphics

 View Only
  • 1.  How to use script to String compare

    Posted 11-19-2019 00:04

    I have a problem with Script, i am do some practice,  if text1 number > text2 then quad visible=ture ,but there not work ,what wrong with my Script ,THX

    dim quad as xpbaseobject

    dim text1 as string

    dim text2 as string

    self.getobjectbyname("Quad1",quad)

    self.getstringbyname("Text1",text1)

    self.getstringbyname("Text2",text2)

    if string.compare(text1 ,text2) then

    quad.visible=true

    else

    quad.visible=false

    end if

     



  • 2.  RE: How to use script to String compare

    Posted 11-19-2019 09:25
    dim quad as xpbaseobject
    dim text1, text2 as xpTextObject

    self.GetObjectByName("Quad1", quad)
    self.GetObjectByName("Text1", text1)
    self.GetObjectByName("Text2", text2)

    if string.compare(text1.Text, text2.Text) > 0 then

    quad.visible=true

    else

    quad.visible=false

    end if

    #XPression


  • 3.  RE: How to use script to String compare

    Posted 11-21-2019 04:06

    Hi Rosca,Thx for respond,but there not work too,the quad.visible always presenting ,even “text1,text2” doesn't have any number


    #XPression


  • 4.  RE: How to use script to String compare

    Posted 11-21-2019 07:07

    Run it in "Sequence" mode.


    #XPression


  • 5.  RE: How to use script to String compare

    Posted 11-21-2019 07:25

    Rosca,yeah i run that in Sequence mode


    #XPression


  • 6.  RE: How to use script to String compare

    Posted 11-21-2019 08:48

    https://youtu.be/p6v2ftO0C2w 

    I don't know if it's a version issue.
    The script doesn't work in this version if the digits are different.


    #XPression


  • 7.  RE: How to use script to String compare

    Posted 11-22-2019 00:04

    my ross  verison 5.7,maybe is really version problem, apperciate Rosca

     


    #XPression


  • 8.  RE: How to use script to String compare

    Posted 11-22-2019 04:32

    Hi Rosca, i find the wrong that i do!  i only Script in "Ononline" But I use to check on "preview Render", so there not work! apperciate Rosca that my problem!

    but i have confusion the code,Why need to" >0"  What that mean? THX

    if string.compare(text1.Text, text2.Text) > 0 then


    #XPression


  • 9.  RE: How to use script to String compare

    Posted 11-22-2019 05:21

    Less than zero : string1 is less than string2.

    Zero : string1 is equal to string2.

    Greater than zero : string1 is grater than string2.


    #XPression


  • 10.  RE: How to use script to String compare

    Posted 11-22-2019 08:29

    Apperciate Rosca ! I understand !

    I have another question, can 3 different text number compare?


    #XPression