Jump to content

Gabriel

Members
  • Posts

    96
  • Joined

  • Last visited

Posts posted by Gabriel

  1. Hello,

     

    Is there a debugger for the Lua scene editor?

    Or there is a working method to debug a script editor without increasing the code with AppLog ()?

     

    Because I doubt the behavior of the loader scene. In my project,

     

    - I created a model "ObjTest" with a script. As a result I did a copy paste the folder of my model that I call "ObjTestV2" and the first "ObjTestV1".

     

    - Then I renamed the files "gmf" in Obj_test_v1.gmf Obj_test_v1.gmf and the other in the same thing for the script file.

     

    - In both script files evenemt UnlockKey, I have a log for a AppLog ("from V1") and the other AppLog ("from V2").

     

    - And then, i reload my scene, the first model has disappeared since I renamed, so I instantiate the object ObjTestV2 and I have a funny surprise, I log in "From V1" and then "From V2 "!

     

    This is normal or not to run a script that is not from the scene?

     

    If this is normal, there is documentation that describes how the scene manager work and the interaction with scripting?

     

    Thank you for your answer

     

    Gabriel

  2. Hello,

     

    I have a small question, I have an animated object "a horse with some animations, idle, run, etc. .." this animation is at position (0,0,0).

     

    l like to know there is a way to merge two animation, first animation of my horse and animation of a bone (one bone) with only position and rotation?

     

    thank you for your help?

     

     

    Gabriel

  3. i try to get in Lua script my instance name with GetKey("name") but return a nil value

     

    ...
    function class:CreateObject(model)
       local object=self.super:CreateObject(model)
    
       AppLog(object.model:GetKey("name")) --    <-- return nil ?
    ...
    

     

    object.model:GetKey("position") work !

     

    how to get my instance name ?

     

     

     

    PS: in file Class.lua at function object:GetKey as no process for the key "name"!

  4. I had never programmed in LUA, I thought I LUA or Basic was the same. I'm stupid to believe it ^ ^

    I bought a book on Lua and is more than a vulgar BASIC interpreter, I just found an incredibly powerful language, but not enough restrictive.

    I say this because I found a solution to my problem and also with the help of "macklebee"

     

    and as I would like to benefit everyone, here is how I solved my problem:

     

     

           Piste = {} -- as global
    
           local function FindEntityByName(name)
                   for model in iterate(CurrentWorld().entities) do
                           if name == model:GetKey("Name") then 
                                   return model
                           end
                   end
                   return nil
          end
    
           local function GetSurfaceCouloirByName(ModName)
                   local ModPiste=FindEntityByName(ModName)
                   assert(ModPiste~= nil,"pas trouvé de piste "..ModName.." dans la scène")
                   local MeshPiste=ModPiste:FindChild("U3D_STATIC_MESH")
                   assert(MeshPiste~= nil,ModName.."trouvé mais pas de mesh portant le nom U3D_STATIC_MESH")
                   local NSurfacePiste=MeshPiste:CountSurfaces()
                   assert(NSurfacePiste > 0,ModName.."->U3D_STATIC_MESH n'a pas de surface !!!")
                   local SurfacePiste=MeshPiste:GetSurface(1)
                   return SurfacePiste
           end
    
           local function StorePathToTable(NonPiste,Surface)
                   local CntVertice = Surface:CountVertices()
                   assert(CntVertice > 0,"la surface n'a pas de vertice ! <StorePathToTable(Surface)>")
                   Piste[NonPiste] = nil
                   Piste[NonPiste] = {}
                   Piste[NonPiste][0] = Vec3(0)
                   for i = 1,CntVertice  do
                           Piste[NonPiste][i] = Surface:GetVertexPosition(i)
                   end
           end
    
           local function ShowPathList(NomPiste)
                   local t = Piste[NomPiste]
                   local lt = #Piste[NomPiste] - 1
                   AppLog(lt)
                   for i = 1,lt do
                           AppLog(t[i].x)
                   end
           end
    
    function class:CreateObject(model)
           local object=self.super:CreateObject(model)
    
           AppLog("Begin------------------------------")
                   local TheSurface = GetSurfaceCouloirByName("Cou1")
                   StorePathToTable("Piste1",TheSurface)
                   ShowPathList("Piste1")
           AppLog("End ------------------------------")
    
    

     

    ;-) thank for all

     

    Gabriel

  5. I suggest adding the relevant entities into a table when they are created, so you can access them later.

     

    If you are trying to find a child of that model, you would just call model:FindChild(name).

     

    ok, but how can I manage that?, in my case, I use the script of models, for example when I place an object on the scene with the editor, I want this object if there is an object in the scene with which it can interact.

     

    In this way the only thing I have to do is execute the loadScene ("myscene") and the rest is automatic as in the editor.

  6. Hello,

     

    I wish I had access to all objects in my scene with the script editor (mesh,surface ...)

     

    I tried this:

     

    function class: CreateObject (model)
        local object = self.super: CreateObject (model)
        e = CurrentWorld().Entities
        f = FindChild (c, "couloir01_2") <- "EXECPTION_ACCESS_VIOLATION"
    ......
    
    

     

    Between me and my editor, there is no way to talk about it continually meets EXECPTION_ACCESS_VIOLATION.

     

    I'm trying to open dialogue, but nothing;-)

     

    someone has an idea to reconcile myself with my editor?

  7. XP Embedded is all like windows XP, but very ease to mobile platform, we are developing on this platform game designed for game room or casino. our products is a bit like atari or sega consoles, but more advanced (two touch screens 23 and 47 inch).

     

     

    Good night ;-) yeah here it was already night

     

    Gabriel

  8. Man I can't get a value returned to Lua from the DLL either to do this the other way I was thinking. I know this used to work as I'm looking at my example from the old forum. I was so close to getting this thing online, but now it's looking like I'm going to have to rewrite it in C++.

     

    static int NetUpdate(lua_State* L)
    {
    RakNet::MessageID msg = -1;
    RakNet::BitStream* reader = NULL;
    
    // check for new packets
    for (packet=peer->Receive(); packet; peer->DeallocatePacket(packet), packet=peer->Receive())
    {
    	// assign the message
    	msg = packet->data[0];
    
    	// assign the bitstream
    	reader = new RakNet::BitStream(packet->data,packet->length,false);
    	reader->IgnoreBytes(sizeof(RakNet::MessageID));
    
    	// special case for connection. need to save off the servers address so we can send data to it later
    	switch(packet->data[0])
    	{
    		case ID_CONNECTION_REQUEST_ACCEPTED:
    
    			WriteLog("Connection request accepted");
    			serverAddress = packet->systemAddress;
    			break;
    	}
    }
    
    // hardcode just to test
    lua_pushnumber(L, 5);
    
    return 1;
    }
    

     

    package.loadlib("C:\\Leadwerks Engine SDK\\RakNetLua.dll", "luaopen_raknet")()
    
    local msgID = raknet.Update()
    
    Notify(msgID)
    

     

    Just prints out nothing (nil)

     

     

    try with

    static int _cdecl NetUpdate(lua_State* L)
    {
    ...
    }
    

     

    May be that the name convention is not recognized by Lua!

    In "C + +" all are decorated like @@foo(ZER_@) but not in "C"

     

     

    Can you tell me if it works like that?

     

    I'm interested;-)

     

    Gabriel

  9. Hi macklebee

     

    It works great :huh:,

     

    But I thought it would give me the "TEntity" with GetTarget function :-( i think it gives me the "TModel", type(GetTarget(0)) return "userdata"

     

    could you tell me how to retrieve the object "TSurface" starting from a model?

     

    Thank you for your invaluable help, Gabriel

  10. the target is not set immediately after creation of the class... if you create the local object and then place the code inside an object function like 'object:UnlockKeys()' that would normally get called automatically, it would work...

     

    but thats just a guess on what is happening because you are apparently removing code from the script, so it is hard to guess... also your explanation is confusing... if it finds the link in any of the possible 8 available targets, it should return ;-)

     

    and you said this is what it returns:

     

    which is correct... the '0' link returns ;-) and the other 7 that have no targets return 'Not Linked'

     

    Hi macklebee

     

    Oup you are right, the smilies was ironic, but you guessed it.

    The application does not find the links and then goes 8 times by the MessageBox ("pfff").

     

    I tried your solution, if you are right then I think the event "UnlockKey" come too soon!

     

    In the tutorial, I see that using this method in an event "Update", so I do have'm also without success :-(

     

    To overcome this problem, I try another method "GetChild" which works perfectly in "C / C + +" because I instantiate the object "scene".

    example:

    TEntity LoadScene scene = ("abstract:: test.sbx");
    Entity = cheval1 FindChild (scene, "ch1"); "
    

     

    But in Lua in my model, I do not know how to have access to the object "scene", I even assumed that the parent object was the scene, but in return I have a nice access violation: - (

     

    Is there an event for the end of the creation of the scene?

     

    If you have an idea it is welcome.

  11. Hello

     

     

    I have few object in my scene, and i link the Horse1 with Horse2 with Link(0)

     

    I try with this code and the responce stay the same "not linked" :%

     

     

     

    function class:CreateObject(model)
    ....
    for n=0,7 do
    chemin = model:GetTarget(n)
    if chemin == nil then
    	Notify("Not Linked")
    else
    	Notify(";-)")
    end
    end
    ....
    
    

     

    the responce stay the the same :-) Not Linked,Not Linked,Not Linked,Not Linked,Not Linked,Not Linked,Not Linked

     

    Please Help me ;-)

     

    Gabriel

    post-4049-0-57791900-1320283929_thumb.png

  12. Hello,

     

    Someone explain to me why this code does not work completely?

     

    function class:CreateObject(model)
    local object=self.super:CreateObject(model) 
    local timer1 = 0
    local ani = AnimStart 
    
    
    local source1 = CreateSource(sound1)
    
    function object:SetKey( key, value )
    		--Notify(key , " - " ,s value)
    		if key=='animationseq' then
    			v=tonumber(value)
    			if v>=0 and v <=15 then
    				AnimationSeq=v
    				AnimStartNext = AnimationStart[v] 
    				AnimEndNext   = AnimationEnd[v]  
    				--Notify(AnimStartNext)
    				--Notify(AnimEndNext)
    			else
    				Notify("Valeur animation 0-15")
    			end
    		end
    
    		if key=='animationspeed' then
    			v=tonumber(value)
    			if v>=0.01 and v <=3 then
    				AnimationSpeed = v 
    			else
    				Notify("Valeur pous animation Speed 0.01-3")
    			end
    		end
    end
    
    .....
    

     

     

    To be more precise it works, but I feel that the function does its ancestor called over the scene.

     

    When I fontion SetKey how everything returns to normal but if the property but not much changed in the basseclass.

     

     

    PS: LUA code is associated with a 3D object gift I wish I could change some properties.

     

    Gabriel

  13.            hWnd = WindowsAPI.FindWindow("DFTester.exe", null);
               WindowsAPI.SetWindowLong(hWnd, WindowsAPI.GWL_STYLE, WindowsAPI.GetWindowLong(hWnd, WindowsAPI.GWL_STYLE) | WindowsAPI.WS_MAXIMIZEBOX);
    
    

     

    as i don't understand the use of FindWindow. is that the way it shoud be used? or should "DFTester.exe" be replaced with something else?

    also would i put this before Graphics() or after it?

     

     

    Hi,

     

    use this :

    	HWND hwnd =FindWindow("BlitzMax GLGraphics",AppTitle);
    	ShowWindow(hwnd,SW_SHOWMAXIMIZED);
    

     

    AppTile is the name by default is "" or use SetAppTitle( AppTitle ) ; befor Graphics(..,..);

     

    ;-)

     

    Gabriel

×
×
  • Create New...