createAnimation()?

  • #10, by AFRLmeWednesday, 08. November, 23:41 2 weeks ago
    You're talking about a Finite State Machine yes?

    Visionaire is kind of rigid - as is Lua script - when it comes to flexibility. It's a game engine specifially designed for creating point & click games aimed at artists, animators & people with little to no program knowledge. All I'm trying to say, is don't get your hopes up for creating some elaborate system out of scripts/functions as it might not be possible. Lua is certainly nowhere near as flexible as C++, C#, Java or Python for that matter.

    I'm a big fan of working outside of the limitations myself, but sometimes you have to give up the Ghost & just work with what is available/possible.

    What you are asking for is a function that probably only you would use which means that the current sole active developer of VS would basically be using up a bunch of his own time just to write & debug a function specifically just so you can save a bit of time. Did you know scripting wasn't even introduced into Visionaire until one of the updates of Visionaire 3? We're talking a while back - before I joined back in 2011 or 2012 - all people had to work with were the premade action parts & built in systems & even back then people still managed to develop & release games just fine with the engine - see Daedalic for example.

    Imperator

    5722 Posts


  • #11, by rhavin grobertFriday, 10. November, 13:44 A week ago
    What you are asking for is a function that probably only you would use
    I completely disagree wink
    Its cool to have the possibility of letting people with little-no-none programming experience develop games. But this product comes with a scriping-engine and claims to be ready for the professional market. And that means: dont think about what you want to do with a module, just implement everything that can be logically done to the module, because someone will come up with a use for it. Especially, if its not reinventing the weel but just exposing a process already implemented (creation of animations from given parameters) to the already implemented scripting-engine.

    BTW, if its just about man-power:
    C++, C#, Java, Javascript and Perl (and some long time not used Basic dialects^^) is what I can offer wink

    Newbie

    36 Posts

  • #12, by AFRLmeFriday, 10. November, 14:04 A week ago
    What you are asking for is a function that probably only you would use
    I completely disagree wink
    Its cool to have the possibility of letting people with little-no-none programming experience develop games. But this product comes with a scriping-engine and claims to be ready for the professional market. And that means: dont think about what you want to do with a module, just implement everything that can be logically done to the module, because someone will come up with a use for it. Especially, if its not reinventing the weel but just exposing a process already implemented (creation of animations from given parameters) to the already implemented scripting-engine.

    BTW, if its just about man-power:
    C++, C#, Java, Javascript and Perl (and some long time not used Basic dialects^^) is what I can offer wink
    Yes it's kind of about manpower, but they aren't going to let you or any other random person they don't know anywhere near the source code.

    Imperator

    5722 Posts

  • #13, by sebastianFriday, 10. November, 14:21 A week ago
    you could press your lua script into a plugin module (possible since VS5 final). 
    Every project can then have custom action parts. Internaly they run lua so they could execute your script stuff. 

    Just click on the cog icon on the top rightin VS and install one of the existing scripts to your project. Then in the project folder you should find it.
    Copy+Paste the downloaded plugin folder and change it to your needs. This would make it more useful for non-script-people.

    Regarding documentation about this new feature: there is not one yet. But the most in it is self explaining.

    Thread Captain

    1926 Posts

  • #14, by rhavin grobertMonday, 13. November, 21:11 A week ago
    This is how I duplicate an animation:

      qp.aniIdx   = 0
      qp.template = getObject("Animations[tunnel0a]")
      qp.fileAlt2 = "Kulissen/UBahn/Tunnel2.jpg"

      qp.createAnimation = function(self,base)
        local name = "QPBckgnd"..tostring(self.aniIdx)
        local dbl = self.template:duplicate(name)
        dbl.AnimationSprites[1].path = self.fileAlt2
        startAnimation(dbl)
        self.aniIdx = self.aniIdx + 1
        local ret = getObject("ActiveAnimations["..name.."]")
        -- *do something*
        return ret 
      end
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15

    - how can I change that duplicates sprite (image)? Line 8 does not seem to work, I guess, it
        does only change the lua-copy of the value, not the entry in the userdata field itself?
        TSprite of course has setPath(), but how do I call a getSprite on dbl or ret? In other words:
        how do it get AnimationSprites[1]? dbl:getLink(":AnimationSprites[1]") is just nil. If I
        dump dbl, it looks like this:
    23:44:18.550:----- animation data start ------
    23:44:18.550:getName(): QPBckgnd0
    23:44:18.551: [info()]: table: 0x037df760
    23:44:18.551: .[AnimationMove]: false
    23:44:18.551: .[AnimationUseIndividualPause]: false
    23:44:18.551: .[AnimationNumberOfLoops]: 0
    23:44:18.551: .[AnimationAction]: ---Empty---
    23:44:18.551: .[AnimationCenter]: table: 0x037e1988
    23:44:18.551: ..[y]: 0
    23:44:18.551: ..[x]: 0
    23:44:18.551: .[AnimationPosition]: table: 0x037dfa68
    23:44:18.551: ..[y]: 0
    23:44:18.551: ..[x]: 0
    23:44:18.551: .[_Name]: QPBckgnd0
    23:44:18.551: .[AnimationPropertyFrames]: table: 0x037e1a18
    23:44:18.551: .[AnimationModelAnimIndex]: -1
    23:44:18.551: .[AnimationReplay]: 0
    23:44:18.551: .[AnimationPause]: 20
    23:44:18.551: .[AnimationWalkSteps]: table: 0x037dfb78
    23:44:18.551: .[AnimationLoopRandom]: false
    23:44:18.551: .[AnimationDirection]: -1
    23:44:18.551: .[AnimationPauses]: table: 0x037dfc48
    23:44:18.551: .[AnimationEndDirection]: -1
    23:44:18.551: .[AnimationMirror]: ---Empty---
    23:44:18.551: .[_Type]: Animation
    23:44:18.551: .[AnimationSprites]: table: 0x037dfca0
    23:44:18.551: ..[1]: table: 0x037df880
    23:44:18.551: ...[path]: Kulissen/UBahn/Tunnel0.jpg
    23:44:18.551: ...[position]: table: 0x037df8a8
    23:44:18.551: ....[y]: 0
    23:44:18.551: ....[x]: 0
    23:44:18.551: ...[pause]: 0
    23:44:18.551: ...[transparency]: 2
    23:44:18.551: ...[transpcolor]: 0
    23:44:18.551: .[AnimationModelName]: 
    23:44:18.551: .[AnimationModelAnimSpeed]: -1
    23:44:18.551: .[_Id]: table: 0x037df820
    23:44:18.551: ..[tableId]: 9
    23:44:18.551: ..[id]: 60
    23:44:18.551: .[_Parent]: MovingTunnel (6,71)
    23:44:18.551: .[AnimationModelFile]: 
    23:44:18.551:------ animation data end -------
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    u


    - how can I change an animations (_Parent…?) scene?

    Newbie

    36 Posts

  • #15, by rhavin grobertTuesday, 14. November, 16:38 A week ago
    I found VAnimationSprites in VS5/lua/createTemplate.lua line 40, with that, I can get a table of sprites, but I still cant call setPath on an element of that table:

    ret.fileAlt2 = "Kulissen/UBahn/Tunnel2.jpg"
    ret.aniIdx = 0 
    ret.template = getObject("Animations[tunnel0a]")

    ret.createAnimation = function(self,base)
      local name = "QPBckgnd"..tostring(self.aniIdx)
      local dbl = self.template:duplicate(name)
      local sprites = dbl:getSprites(VAnimationSprites)

      -- works but just changes value in table, not in game
      sprites[1].path = self.fileAlt2

      -- error: "attempt to call method 'setPath' (a nil value)"
      sprites[1]:setPath(self.fileAlt2)

      startAnimation(dbl) 
      self.aniIdx = self.aniIdx + 1
      local ret = getObject("ActiveAnimations["..name.."]")
      return ret 
    end
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20

    What command gives me the TSprite i'm looking for…?

    Newbie

    36 Posts

  • #16, by AFRLmeTuesday, 14. November, 18:47 A week ago
    linking to files for images, sounds, videos & so on requires you to add vispath: in front of the path.
    local sprite = "vispath:images/ball.png"
    1

    Imperator

    5722 Posts

  • #17, by rhavin grobertTuesday, 14. November, 19:39 A week ago
    linking to files for images, sounds, videos & so on requires you to add vispath: in front of the path.
    local sprite = "vispath:images/ball.png"
    1

    That doesnt answer the question. It is:

    How do I get a something (read: first TSprite) from my animation that I can call the :setPath()-method on?

    :getSprites(VAnimationSprites) returns a passive table data-structure, its first element contains the data of the sprite but is unaware of any of TSprites methods.

    I need that Object:

    https://www.visionaire-studio.com/luadocs/#tsprite

    Newbie

    36 Posts

  • #18, by AFRLmeTuesday, 14. November, 20:21 A week ago
    Sorry mate, I really don't know. None of us ever bother creating anything like this.

    Quick question: you do know it's possible to draw images/text via Lua script? I believe those images can be moved, rotated, scaled as you like as well as being able to adjust the transparency too. I'm pretty sure there's some examples Simon wrote floating around on the luadocs website...

    Imperator

    5722 Posts

  • #19, by rhavin grobertFriday, 17. November, 18:04 6 days ago
    Sorry mate, I really don't know. None of us ever bother creating anything like this.

    Quick question: you do know it's possible to draw images/text via Lua script? I believe those images can be moved, rotated, scaled as you like as well as being able to adjust the transparency too. I'm pretty sure there's some examples Simon wrote floating around on the luadocs website...
    Of course, I dont want to do the animation in Lua, its just the set-up of the animation should happen there. I still need to know how I can get a TSprite from the table returned by :getSprites(VAnimationSprites),  as TSprite has the abillity to set the path with its :setPath()-Method. I just cant find any documentation how to get access to it. And :getSprites(VAnimationSprites) doesnt return an array of TSprites (which would be expected), it just a returns a table of data, which is quite useless.


    Newbie

    36 Posts

  • #20, by AFRLmeFriday, 17. November, 20:24 6 days ago
    If you try returning getSprites as it is then it will just return a table name/id. I think you have to iterate through it. Try using a for loop & printing the values with that.
    local spr = Animations["example"]:getSprites(VAnimationSprites)

    for i = 1, #spr do
     print(spr[1])
    end
    1
    2
    3
    4
    5

    I know that's probably incorrect as I'm writing an example off the top of my head, but whatever.

    Imperator

    5722 Posts

Write post