logo hyperPad Forum
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Search
    • Login

    Can attributes work across layers?

    Scheduled Pinned Locked Moved
    Help and Support
    4
    15
    927
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • Jack8680J
      Jack8680 @This
      last edited by

      @This in the first one, it is getting the attribute straight away. Is it at 1 from the start or does it get set to 1 after the get attribute has already run? Maybe share the download link.

      1 Reply Last reply Reply Quote 0
      • iTap DevelopmentI
        iTap Development @Jack8680
        last edited by

        @Jack8680 oh, I don't think I set an object on the global part🤔 that probably what's wrong😃

        1 Reply Last reply Reply Quote 0
        • HamedH
          Hamed Admin
          last edited by

          Yeah, right now you can't set attributes on the global object. So you need to select an object to set an attribute on. The easiest way is to create an object on global UI, which will do what you want it to do.

          iTap DevelopmentI 1 Reply Last reply Reply Quote 0
          • ThisT
            This
            last edited by

            So, I've created an empty object on the global UI level with an attribute. The default value of that attribute is 0. I have a rule on one layer that sets the attribute value to 1 when an object is touched. I have a rule on another layer that is pictured in the first screen grab above: behavior bundle, get attribute, if attribute is greater than 0, execute behavior. The only thing I can think of, does get attribute not constantly check to see if the attribute has been changed?

            1 Reply Last reply Reply Quote 0
            • iTap DevelopmentI
              iTap Development @Hamed
              last edited by

              @Hamed will it work on global if you just select an object for the attribute?

              ThisT 1 Reply Last reply Reply Quote 0
              • ThisT
                This @iTap Development
                last edited by

                @iTap-Development Just tried it. Doesn't work. I think it might have something to do with the second layer not being aware that the attribute has been changed. Does "get attribute" constantly check to see if the attribute has changed or just do it once upon launch?

                1 Reply Last reply Reply Quote 0
                • ThisT
                  This
                  last edited by

                  Okay, I can get it to work, if I add a Start Touch behavior, which is not what I want it to do. I think I now understand that "get attribute" either executes immediately in launch or executes when it is triggered. What I am trying to figure out is how to have a behavior that is constantly monitoring for a change in the attribute. In the attached screen grab, I can get the left column to work, but the right column doesn't. The right column is what I would like. Anyway to achieve this?

                  0_1490730271376_IMG_0896.PNG

                  1 Reply Last reply Reply Quote 0
                  • HamedH
                    Hamed Admin
                    last edited by

                    If you need a constant check, use a timer of 0 (ie. check every frame)

                    Usually timers of zero means that there is probably a better way of doing it. So if you know when you should update the attribute, its probably better to do it once.

                    ThisT 1 Reply Last reply Reply Quote 0
                    • ThisT
                      This @Hamed
                      last edited by

                      @Hamed Got it. Set timer to .1 and that worked. WIll the timer make it run slower?

                      About an easier way, are there ways in HP for behaviors to automatically be aware of when attributes change?

                      Jack8680J 1 Reply Last reply Reply Quote 0
                      • Jack8680J
                        Jack8680 @This
                        last edited by Jack8680

                        @This if you want it to happen every time the attribute satisfies a condition, you could use an execute behaviour in the objects that set the attribute, executing the get attribute and check if it's greater. That way, it checks if the attribute is greater than one every time you change the attribute.

                        1 Reply Last reply Reply Quote 0
                        • First post
                          Last post