Jump to content

Hey

please be considerate and disable AD blocker when you are on the C4D Cafe, because it helps us run this forum. We minimalized showing of the AD's all across the forums, so please, be so kind and at least help us by having AD blocker turned off. 



SolarPH

UserData ID Scanning

Recommended Posts

Abyss    19
4 minutes ago, SolarPH said:

it prints out True even if I changed the "True" with "x"

 

but I can't find out how should I use it as a boole result for an if-else statement

That's what I added underneath my last post

 

you can also use this to find out which of the number in the list was found.

 

for x in lst:
        if x in OBJ_C:
            print x

 

Share this post


Link to post
Share on other sites

SolarPH    6
  • Topic Author
  • Just now, Abyss said:

    That's what I added underneath my last post

     

    You mean I just need to replace "print any" with "if"?

    Share this post


    Link to post
    Share on other sites
    Abyss    19
    1 minute ago, SolarPH said:

    You mean I just need to replace "print any" with "if"?

    this was my complete post:

    just assign that any part to a variable and then you can just check if that value is True

     

    ##################

    DATA_REGISTRY = [203,200,202,201] # any order
     

    print any((True for x in DATA_REGISTRY if x in OBJ_C))

     

    _________

     

    so something like this

     

        lst = [200,201,202,203,204]
        DATA_REGISTRY = any((True for x in lst if x in OBJ_C))
        
        if DATA_REGISTRY is True:
            print "yay"
        else:
            print "nay"

    Share this post


    Link to post
    Share on other sites
    SolarPH    6
  • Topic Author
  • 16 minutes ago, Abyss said:

    so something like this

     

        lst = [200,201,202,203,204]
        DATA_REGISTRY = any((True for x in lst if x in OBJ_C))
        
        if DATA_REGISTRY is True:
            print "yay"
        else:
            print "nay"

    So, I made the exact pattern as that. my script now forms this:

     

    OBJ_RANDOM = any((True for x in DATA_REGISTRY if x in OBJ_C))
        
        print OBJ_RANDOM
        if OBJ_RANDOM == True:
            print "yay"
        else:
            print "nay"
            obj[c4d.ID_USERDATA,1] = NullPort

     

    it now works as expected. thanks for the help to expand the scan of the required IDs.

     

    I will come back later if any problems have been encountered. By now, it's time to sleep.

    Share this post


    Link to post
    Share on other sites

    Create an account or sign in to comment

    You need to be a member in order to leave a comment

    Create an account

    Sign up for a new account in our community. It's easy!

    Register a new account

    Sign in

    Already have an account? Sign in here.

    Sign In Now

    • Recently Browsing   0 members

      No registered users viewing this page.

    ×