Login / Registrieren
DE EN FR ES IT CZ
Zurück Nach oben

Character's shadow

  • #10, by ke4 11 years ago Zitieren
    It says failed to open the file.
  • #11, by afrlme 11 years ago Zitieren
    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.
  • #12, by ke4 11 years ago Zitieren
    I think a deleted the file once and then copy one from another project and pasted it in my project folder. Okay, thanks!
  • #13, by ke4 11 years ago Zitieren
    Error from the Log.

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

  • #14, by afrlme 11 years ago Zitieren
    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")
    
  • #15, by ke4 11 years ago Zitieren
    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.
  • #16, by afrlme 11 years ago Zitieren
    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.
  • #17, by ke4 11 years ago Zitieren
    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.
  • #18, by afrlme 11 years ago Zitieren
    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.
  • #19, by ke4 11 years ago Zitieren
    I think we both are speaking about different thing, never mind razz
  • #20, by afrlme 11 years ago Zitieren
    What were you talking about then?