Little help with an old issue (Showing Attribute values on Screen)

Hi!

I have a tiny issue with the idea of show on screen the values of certain attributes, just to log and test some functions.

I know that this is a very old-solved issue, but i couldn't find it now on the forums :(
(sorry!)

And thanks in advance :D

Comments

  • DuendeArkanoDuendeArkano Member Posts: 52
    The problem is that i don't remember how to do it! :D thanks!!!
  • hotMagichotMagic Member, PRO Posts: 266
    Just use display text. If you need to see values of offscreen stuff, use log Debugging state.
  • jamie_cjamie_c ImagineLabs.rocks Member, PRO Posts: 5,772
    Hey there. Create a new actor and add a display text behavior too it. Have the display text behavior display the value of whatever Attribute you want to keep an eye on.
  • tatiangtatiang Member, Sous Chef, PRO, Senior Sous-Chef Posts: 11,949
    In addition, make sure to use the expression editor (the little 'e' button) and _select_ the attribute rather than typing its name in.

    New to GameSalad? (FAQs)   |   Tutorials   |   Templates   |   Greenleaf Games   |   Educator & Certified GameSalad User

  • DuendeArkanoDuendeArkano Member Posts: 52
    Thank you guys! im working on it! in few hours i'll give you feedback :D
  • DuendeArkanoDuendeArkano Member Posts: 52
    The thing i've done finally is this:

    I put a Save Attrib. in an Actor
    I put this data on a new Attrib on Scene Attrib (could i call an attribute from another actor to my actual actor?)
    I create a new Actor with a Load Attrib and Display Text

    More or less its working (im trying to track the self.motion.linear.y and give me weird numbers)

    You thinkg guys its the shortest way to do it?


    Thanks in advance :D
  • gyroscopegyroscope I am here.Member, Sous Chef, PRO Posts: 6,598

    @DuendeArkano

    hi, you've got it a bit confused, I'm thinking... you've got a certain attribute (Let's call it TheAtt) and you're saving it with a Save Attribute behaviour. So when you use a Load Behaviour, you're already updating TheAtt with its saved value... (there's no need to "tip" it into another attribute.... something which you can do, but in this case, as far as I can make out, you don't need to do).

    So in your Display Text behaviour if you show TheAtt, it will show you the saved, updated attribute value.

    But not on your Mac; only in the Viewer on your device. Hope that's cleared it up a bit for you.

    ""You are in a maze of twisty passages, all alike." - Zork        temp domain http://spidergriffin.wix.com/alphaghostapps

  • DuendeArkanoDuendeArkano Member Posts: 52
    Hi gyroscope!

    I explain a bit more my problem:

    I have actorA who have a attribute motion.linear.y ; i want to track the position of the actorA.

    So i create a new Actor "Tracker" but this actor does not let me call an Attribute from actorA, then i create a new Attributes inside Scene Attributes (i called Y) and then i call this atribute from the new actor "Tracker"

    I try to quit the Load Attribute from the "Tracker" but the value does not change on screen.

    This is what i have:

    actorA:

    Timer every 0,1
    Save attribute self.motion.linear.y to game.y



    Tracker:

    Timer every 0,1
    Load Attribute game.y
    Display Text game.y


    In the otherhand... what do you mean with i won't see it in my mac, just on the viewer of my device?


    Thanks a lot, really :D
  • gyroscopegyroscope I am here.Member, Sous Chef, PRO Posts: 6,598
    edited November 2012

    Ah, I see what you're after... First to say, if you want to update an attribute over time, in other words to track another attribute; and in this case to track your actor's Motion.linear.y, then you must use a Constrain Attribute behaviour. This will update in realtime for you.

    Next to say, you're actor called Tracker: the reason you can't "call" an attribute from another actor is because the actor is locked, in the inspector (it's what's known as a Prototype). If you drag the actor on-creen and click on the lock symbol it will unlock, (the actor now an Instance - or to be really precise, an instance of its Prototype). Now you'll be able to see other actor's self.attributes via the expression editor in its Rules section. But....if you want to call up scene or game attributes only, there is no need to unlock the actor, and all your rules will be made in the locked prototype in the Inspector.

    Finally to say, you are not using the Save Attribute behaviour and Load Attribute behaviour in the correct way....sorry to tell you! These behaviours are specifically used for saving attributes in a special file in the device (iPad, iPhone, even the Mac) and so when you quit the app, when you restart, providing there's a button to continue which loads the specific saved behaviours into the app's memory, with a Load Attribute behaviour, (one equivalent for each Save behaviour), they will be updated to their last state....(instead of just starting from scratch if you hadn't saved the attributes). So that's what Save & Load Attribute Behaviours are for.

    Hope that's cleared up a few things and my explanations have helped rather than confused you more!

    ----------

    Now to the problem you have...so based on what I've described above,

    You make a scene real attribute and call it MotionY, for instance. Then make your actor called Tracker and place that on-screen. Unlock it.

    In its rules, place a Display Text behaviour and via the Expression Editor, make its Text as MotionY.

    Then put :

    Constrain Attribute MotionY to scene.Background.actorA.Motion.Linear Velocity.y

    --------

    Hope that's all clearer for you now. :-)


    ""You are in a maze of twisty passages, all alike." - Zork        temp domain http://spidergriffin.wix.com/alphaghostapps

  • jamie_cjamie_c ImagineLabs.rocks Member, PRO Posts: 5,772
    Hi, don't forget you could just temporarily slap a display text behavior on your actual actor and display any of its local actor attributes real time right on the actor itself. The just delete the display text when you are done.
  • DuendeArkanoDuendeArkano Member Posts: 52
    WOW!

    Thanks for such big response!!! :DDDDD

    Gyroscope, thanks a lot! now i understand better the solution to my issue, when i started to work with load/save attribute something inside me said "this is not the correct way, should be other way" jajajaja so now i understand what its the porpouse for this attributes.

    I will continue the work with this tomorrow, but i think its more than explained here, so i think i wont have so much problems with it :) if i have it, i'll let you know ^^ jjj

    In all the ways, THANK YOU GUYS!!! Specially Gyroscope ;) you're a master.


    See you soon guys!
  • DuendeArkanoDuendeArkano Member Posts: 52
    Hi people!

    Im sorry to say i didn't reach the solution to my problem :((((


    Gyroscope, i did what you tell me about unlocking the actor, constrain attribute and so, but the result its that the attribute who have to been updated it is not :/ and its weird because its motion.linear.Y and this is a kind of attribute that always change if the Actor is moving; but nothing happens, i tried also with a boolean, with the same result.

    Then i tried to split the constrain and the display text; i put the constrain inside the actor and the text display on the Tracker; for linear.motion.y the values who give me from the tracker are kind of weird too (100, -200, -2335765e-10) but for the boolean, nothing changes... so i think im doing wrong again with this idea.


    What i have on the trackers:

    -Constrain Attribute game.Y (i tried also with just Y) to scene.Background.ShadowSolid.Motion.Linear Velocity.y

    -Display Text: game.prueba


    What im doing wrong??? :(((

    Sorry for bothering guys, and a lot of thanks in advance!!!!!!


  • gyroscopegyroscope I am here.Member, Sous Chef, PRO Posts: 6,598

    Hi Duende


    In all the ways, THANK YOU GUYS!!! Specially Gyroscope ;) you're a master.

    i'm far from that, but thanks for such a nice compliment! :-)

    OK, your game attribute you've called Y: make sure this is a real attribute. This is like an integer but unlike integer, which is for whole numbers only, a real attribute shows fractions too.

    For the Display Text, you obviously want to display this attribute as it's being constrained, so put in the same attribute. Now we have:

    Constrain Attribute game.Y to scene.Background.ShadowSolid.Motion.Linear Velocity.y

    -Display Text: game.Y

    PS You might want to make the attribute name a bit more detailed than just Y, otherwise when you have a lot more attributes, you could get confused as to what it's referring too... ;-)

    ""You are in a maze of twisty passages, all alike." - Zork        temp domain http://spidergriffin.wix.com/alphaghostapps

  • DuendeArkanoDuendeArkano Member Posts: 52
    im afraid everything is as it should, (Y is real and im calling it game.Y on the rules)

    but it does not work ¿?¿? maybe i should re start all the scene? could be an error from game salad?? or maybe something's wrong with my mac??
  • gyroscopegyroscope I am here.Member, Sous Chef, PRO Posts: 6,598

    Hmm, although in your example, you're saying you are putting Display Text: game.prueba rather than Display Text: game.Y which it should be -- could that be it?

    ""You are in a maze of twisty passages, all alike." - Zork        temp domain http://spidergriffin.wix.com/alphaghostapps

  • DuendeArkanoDuendeArkano Member Posts: 52
    No, im using Y and prueba like examples, and yes, im replacing the names jijiji, sometimes you create a new attribute, you delete it, create new one.. that's why i change the name, sorry for the mess :(

    But its absolutely weird, it should work!!! i think i'll create a new project and i'll start with the constrain thing and the animation issue... because i did not find sense to this to don't work :/
  • gyroscopegyroscope I am here.Member, Sous Chef, PRO Posts: 6,598
    edited December 2012

    OK, I've just done a test and it's much clearer now than trying to sort this l'il problem out in my head:

    You want to display the linear velocity of an actor: a linear velocity is a fixed value and so you don't need a Constrain Behaviour at all in this....

    This was my mistake, I suggested a constrain when a change attribute would have done here.... sorry to confuse you!

    Also to say, you might want to put your Display Text behaviour is in a different actor.... (you don't have to though, as @Jamie_c suggested...)

    So now:
    Change Attribute game.Y to scene.Background.ShadowSolid.Motion.Linear Velocity.y

    Display Text: game.Y

    That's it, straight and simple, exactly as the other guys said, before I unnecessarily complicated things!

    ""You are in a maze of twisty passages, all alike." - Zork        temp domain http://spidergriffin.wix.com/alphaghostapps

  • DuendeArkanoDuendeArkano Member Posts: 52
    jajjajaa ok! no problem at all!! we are humans after all jajaja

    i will go to eat something and i'll start with it :)
  • DuendeArkanoDuendeArkano Member Posts: 52
    i did it with X and Y with the same result :( "0" but my actor is moving, and some of my rules triggers with X,Y position, so this values are changing, but the tracker doesn't show it.

    I also used a timer, but doesn't help at all

    i dunno what to say :/ any idea people? :S :/


    By the way: when i should use constrain and change att. in order to track attributes?
  • gyroscopegyroscope I am here.Member, Sous Chef, PRO Posts: 6,598
    edited December 2012

    Hi, a Constrain Attribute is used (normally a real type) if the value it is tracking is changing. Use a Change Attribute (mainly an integer) if the value it takes is fixed. For either one, a Timer is not needed.

    So in your first example, you're not actually tracking anything, because the actor's linear velocity is fixed and doesn't change; so you use a Change Attribute behaviour.

    However, for something like an actor's Y position, if the actor is moving, then you'll need a Constrain attribute to "keep up" with the changing value.

    So your first example, getting an attribute the same as a fixed value, use a change attribute:

    Change Attribute game.Y to scene.Background.ShadowSolid.Motion.Linear Velocity.y

    Display Text: game.Y

    For another example, getting an attribute to follow a changing value such as a moving actor's x or y position, use a Constrain behaviour:

    Constrain Attribute game.PosY to scene.Background.ShadowSolid.Position.y

    Display Text: game.PosY

    Hope that's cleared it for you.

    ""You are in a maze of twisty passages, all alike." - Zork        temp domain http://spidergriffin.wix.com/alphaghostapps

  • DuendeArkanoDuendeArkano Member Posts: 52
    Thanks a lot!

    Yes it is more clear :)

    The weird thing is (as you can see on the posse rules on the other post) the linear velocity.y for ShadowSolid its a trigger to show the falling image, so its not fixed, but if i tell you the truth i did not make this rules, this rules are from the platform template, thats why im on this giga mess xDDD

    I'll keep working on it, and when a found a complete solution i'll make a tutorial for neewbies like me jejeje :)

    Thanks again :)
  • DuendeArkanoDuendeArkano Member Posts: 52
    I couldn`t make it work, with or without a timer, using constrain attribute.

    Im sure you guys use this kind of thing on your usual work with GS, can you make a tiny example for me using your own rules?

    It would be great :D
  • gyroscopegyroscope I am here.Member, Sous Chef, PRO Posts: 6,598
    edited December 2012

    Hi, here's a small test as an example of using the Constrain Attribute behaviour; hope it helps.

    ""You are in a maze of twisty passages, all alike." - Zork        temp domain http://spidergriffin.wix.com/alphaghostapps

  • DuendeArkanoDuendeArkano Member Posts: 52
    Yes!, it works!

    Thank you so much gyroscope :)
Sign In or Register to comment.