High Score Display (CMS) not working properly

  • #1, z OrlixThursday, 02. June 2016, 01:52 hodinky 9 years ago
    Hi

    I´m new here, and taking the first steps on visionaire studio.

    I´m using version 4.2.5 free to test this platform. I would like to implement a score system, and after some search i have found this tutorial:

    https://wiki.visionaire-tracker.net/wiki/High_Score_Display_(CMS)

    But unfortunately i´m not able to get this working properly.

    I read somewhere in this forum that animations must be in an infinite loop, and this is right. But i get a weird start until i get no score, the number animation is looping on and on until i score something, stopping in the correct score after that.

    You can see what i´m talking about here:
    http://screencast.com/t/l2neuNrLtBL

    Any help will be highly appreciated.
    Thank you very much.
    Orlando

    Bažant

    20 Posts


  • #2, z afrlmeThursday, 02. June 2016, 03:16 hodinky 9 years ago
    Sorry... I wrote it a while ago & the engine has probably changed in some way since I wrote it. There's another method you could use that doesn't involve animations at all.

    Use a value to store the score in. You can also increment it as needed to via action parts. Now you can display the score inside of a display narration text action or a display object text action or you could even directly write the text on the screen with the new Lua draw functions that were added to VS 4.2.5.

    Please check out the about display text related page found in the manual section of the wiki.

    In regards to your video, it seems the script is not controlling your animations. Are you sure you linked to the correct animations? Correctly followed the instructions on the wiki page? etc... I don't remember if I included a ved demo in the resource section of the page? Probably not though as I tested the script out in the Zak 2 ved.

    Anyway... hope you manage to resolve the issue. It's a bit late here at the minute for me to do anything (3:16am).

    P.S: have you checked the log for errors / warnings?

    P.P.S: welcome to VS. Happy developing. wink

    Imperátor

    7285 Posts

  • #3, z sebastianThursday, 02. June 2016, 08:23 hodinky 9 years ago
    As Lee mentioned its the easiest way to show a text with the scores value. You are able to preapply also zeros to the score if you want to have always e.g. 8 Numbers (score: 00001253)
    I didt watch the video because of no Flash on my Smartphone. So i have to guess here a bit what is really needed...

    If you need animations because you want to show them in a more elegant way or spread them all over the screen / scene the animation method would be a good way.

    I dont get the idea behind the script from the wikipage right now and how it actually work.
    I would do a bit more math here and save the value of each 1,10,100,1000 digit in separart values and then do the animation work. But i guess using the string length is also a great and much shorter way...

    What the problem here is right now is that the animation at first time wasnt cut to what it should display. Try to execute the script and add "0" to initialize the displayed score at the beginning.

    P.S: Is the lua draw method anywhere documented?

    Kapitán

    2346 Posts

  • #4, z afrlmeThursday, 02. June 2016, 13:06 hodinky 9 years ago
    @ Sebastian.204: no, not currently mate. I've still not spoken to Simon about it & he's not created a wiki page for it either. The only available examples are what David posted to the second page of the thread regarding the release of VS 4.2.5. If you search for "4.2.5", you should find the thread easy enough.

    The animation method works by splitting the digits into multiple values & then asigning each value to an animation, in which you use said values to force which frame should be displayed (+1 as the animation index starts at 1, which means 0 would be 1 & 1 would be 2, etc). You could of course use a single value & use the lua split function to return a digit per animation too. In a way that would be fairly useful as you could use that to determine how many animations you need running at the same time.

    Imperátor

    7285 Posts

  • #5, z OrlixThursday, 02. June 2016, 14:45 hodinky 9 years ago
    Hi

    Thank you very much for the quick answer. I have managed to solve this issue adding some more scripting to the beginning.

    getObject("ActiveAnimations[ani_inc]"):setValue(VAnimationFirstFrame, 1)
    getObject("ActiveAnimations[ani_inc]"):setValue(VAnimationLastFrame, 1)
    getObject("ActiveAnimations[ani_d1]"):setValue(VAnimationFirstFrame, 0)
    getObject("ActiveAnimations[ani_d2]"):setValue(VAnimationFirstFrame, 0)
    getObject("ActiveAnimations[ani_d1]"):setValue(VAnimationLastFrame, 0)
    getObject("ActiveAnimations[ani_d2]"):setValue(VAnimationLastFrame, 0)
    


    Note: the original script was modified to keep a two digit score only.

    In fact, i don´t know if this is the most correct way to do this because i´m not comfortable with Lua Script yet, but is working for it´s propose.

    Best regards,
    Orlando

    Bažant

    20 Posts

  • #6, z afrlmeThursday, 02. June 2016, 15:30 hodinky 9 years ago
    Nice one for managing to sort it out yourself! wink

    Quick note #1: the minimum value should be "1" not 0. The animation index starts at 1.

    Quick note #2: I must have written this quite a while ago as it's using the old getObject() method.

    ActiveAnimations["test"].AnimationLastFrame = 1
    


    P.S: I believe the issue with the script is probably because it was trying to access animations that don't exist. VS & Lua in general don't like it when you try to access things that don't exist - especially when trying via a script as sometimes it prevents parts of a script from being allowed to execute.

    P.P.S: my scripts on the wiki are meant as a guide / template. They aren't plug & play as most of the time, scripts need to be tailored to suit the project they are being implemented into.

    Imperátor

    7285 Posts