Character's shadow

  • #10, by ke4Sunday, 10. May 2015, 16:44 9 years ago
    It says failed to open the file.

    Key Killer

    810 Posts


  • #11, by afrlmeSunday, 10. May 2015, 16:47 9 years ago
    very strange. Not really sure what to tell you then. Try sending a pm to SimonS or BigStans & see if they might know the reason why your log is not working.

    Imperator

    7278 Posts

  • #12, by ke4Sunday, 10. May 2015, 16:50 9 years ago
    I think a deleted the file once and then copy one from another project and pasted it in my project folder. Okay, thanks!

    Key Killer

    810 Posts

  • #13, by ke4Monday, 11. May 2015, 21:26 9 years ago
    Error from the Log.

    Error: Unknown data-field "Scene"
    It's printed maybe 50 times.

    Key Killer

    810 Posts

  • #14, by afrlmeMonday, 11. May 2015, 22:18 9 years ago
    Ah yeah sorry. replace all instances of .Scene with .CharacterScene.

    I'm never too sure what will work or not off the top of my head when it comes to shorthand Lua. Sometimes it works when you crop out most of name.

    For instance if I want to access / update a character's position, then I only need to type .Position instead of .CharacterPosition or VCharacterPosition.

    It's a bit strange like that.

    local pos
    
    function setCharacterShadow()
     if Characters["shadow"].CharacterScene:getName() ~= game.CurrentCharacter.CharacterScene:getName() then Characters["shadow"].CharacterScene = game.CurrentCharacter.CharacterScene end
     if game.CurrentScene:getName() == game.CurrentCharacter.CharacterScene:getName() and game.CurrentScene:getName() == Characters["shadow"].CharacterScene:getName() then
      pos = game.CurrentCharacter.Position
      Characters["shadow"].Position = { x = pos.x, y = (pos.y - 10) }
     end
    end
    
    registerEventHandler("mainLoop", "setCharacterShadow")
    

    Imperator

    7278 Posts

  • #15, by ke4Monday, 11. May 2015, 22:26 9 years ago
    strange..
    Guess all these things are somewhere in the documentation, i don't know but it's confusing for me i have to learn how to use it.

    And it works perfectly now, thank you Lee.

    Key Killer

    810 Posts

  • #16, by afrlmeMonday, 11. May 2015, 22:48 9 years ago
    No, not in the documentation. I'm not sure whether or not Simon has finished optimizing the new shorthand Lua script functions, variables & tables or not. All I know for sure is that some of them can be accessed with partial field names & some can be accessed with full field name & some can be accessed with both.

    Here's another for instance... Values["name"].ValueInt returns an error I think whereas Values["name"].Int returns the integer value, whereas with conditions you have to use ConditionValue otherwise it returns an error. See what I mean? It's a bit hit & miss at the minute. All you need to do really is look at data structure & then figure out which parts of the field name are required.

    Imperator

    7278 Posts

  • #17, by ke4Wednesday, 13. May 2015, 12:25 9 years ago
    Yes.
    I meant for example this part
    Characters["shadow"].CharacterScene = game.CurrentCharacter.CharacterScene
    


    Even if this is in data structure i didn't realize it can be set like this i was thinking of some :setValue way.

    I guess i wont need the part for checking if they are on the same scene, if the first line sets them to be.

    Key Killer

    810 Posts

  • #18, by afrlmeWednesday, 13. May 2015, 14:58 9 years ago
    I believe I updated the data structure page a little while back with a few notes about the new shorthand. It's a pretty recent edition. It was actually available back in the previous public build but it was not as optimized, as most tables could not be accessed properly using shorthand.

    & nope I guess you won't be needing it.

    Imperator

    7278 Posts

  • #19, by ke4Wednesday, 13. May 2015, 15:15 9 years ago
    I think we both are speaking about different thing, never mind razz

    Key Killer

    810 Posts

  • #20, by afrlmeWednesday, 13. May 2015, 16:01 9 years ago
    What were you talking about then?

    Imperator

    7278 Posts