Jump to content

Guppy

Members
  • Posts

    775
  • Joined

  • Last visited

Posts posted by Guppy

  1. Entity->CallFunction comes in two flavors, one that seems aimed at collisions and one that passes an Object pointer.

     

    I'm not entirely sure how I'm supposed to use this to pass data to the function I'm calling, I can set a void pointer as "userdata" which isn't terribly usefull - the source claims to export it to lua but the documentations says it's not exposed in lua.

     

    Is it possible to use this to pass a table to lua? and failing that can I somehow convince CallFunction to pass along the information that I've pushed a table onto the stack?

     

     

    Right now I'm resorting to putting the table into a global, which is not really ideal.

     

     

    Now I can sidestep using CallFunction by doing

     

    Leadwerks::Interpreter::GetGlobal("Player:Test");
    lua_pcall(Leadwerks::Interpreter::L, 1, 0, 0);
    

     

    Unfortunately I've no idea what Global to use ( in the above I'm trying to target the Test function inside Player )

  2. This one has been driving me nuts, the below code fails to build in leadwerks

    namespace MyGUI{
     enum Enum
     {
      Button0 = 0,
      Button1,
      Button2,
      Button3,
      Button4,
      Button5,
      Button6,
      Button7,
      MAX
     };
    }
    

     

    I finally tracked it down to Button1 being #defined as 1 - presumably somewhere in the leadwerks linked library as I certainly haven't made that it and MyGUI builds just fine.

     

    I've worked around it so far by simply commenting out buttons 1-7 and setting MAX to 8 explicitly - but now I need to pass Enum:Button1 so I kind of need it.

     

    I can do

    #undef Button1
    #undef Button2
    #undef Button3
    #undef Button4
    #undef Button5
    

    In this header file and it also solves the problem - but I'm not sure if that will screw something up for LE, or even why those defines exists in the first place

  3. Rick is correct about c++ being harder than lua but in the long run c++ is more usefull to know.

    Le 3.1 uses a subset of c++ which makes things a lot easier.You don't need to learn the whole language before starting a game.Just learn the basics and then go by the command reference.

     

    Judging by his comments so far I don't believe he can program at all, so learning lua first and getting to grip with concepts such as variables and control structures is properly a good idea.

     

    Then once he feels comfortable with lua and the idea of programming, we show him c/c++ and tell him the horror story of the star that eats memory. wink.png

  4. (the ones from the work shop)

     

    How are they supposed to work?

     

    Here is what I've tried;

     

    Modified the FPScontroler script to take an optional external camera, IMO this should be part of the default script. I also added

    self.camera:SetKeyValue("skybox_texture","Materials/Sky/skybox_texture.tex")
    self.camera:SetKeyValue("skybox_intensity","1.0")
    

     

     

     

    On said camera I've tried plugging in each of the scripts in turn to no avail - in fact when saving the map and reloading the camera has no scripts attached.

     

    I've tried to open the script in the editor to try and find a hint of how to use it, but I cannot - guess it's some sort of content protection scheme kicking in there.

  5. Try deleting your Leadwerks config and let it generate a new one, especially if you didn't do exactly that when the editor features were added under Linux recently.

     

    I did not - how do I do that?

  6. Maybe a stupid question but how do I debug in Lua?

     

    I can set a break point but I cannot set watches or inspect variables and if something goes wrong or I make a typo it just crashed with no warning.

     

    Shouldn't there be a lua console or something?

  7. Hello, sorry for the long reply.

     

    I did actually rebuild. This is what the command outputs:

    0x000000000000000f (RPATH)			 Library rpath: [$ORIGIN]
    

     

    In that case there remains two possible error causes;

    1. libsteam_api.so is NOT in the same directory as your executable ( or is broken, try replacing it with the with one from a fresh project )
    2. Your missreading the error and what you see is just the "no running steam instance found" message

  8. To illustrate the problem more clearly than the above ramblings;

     

    Holding down shift and hitting h,e,l,l,o

     

    results in:

     

    H:16

    D:16

    H:72

    D:72

    H:69

    D:69

    H:76

    D:76

    H:76

    D:76

    H:79

    D:79

     

    with this code

     for( int i=0; i < 256; i++ ){
    		 if ( window->keyhitstate[i] )
    		 std::cerr << "H:" << std::to_string(i) << std::endl;
    		 if ( window->keydownstate[i] )
    		 std::cerr << "D:" << std::to_string(i) << std::endl;
     }
    

     

    Where each new letter should also have a D:16

×
×
  • Create New...