Jump to content

AndyGFX

Members
  • Posts

    124
  • Joined

  • Last visited

Everything posted by AndyGFX

  1. From editor set properties on your model like mass and Collision Type, when property windows is empty - add lua script with name like your model. Note: Template script is in Scripts folder ("template.lua").
  2. Lua 5.1 has lib table, which works like TList container: LUA Table Library
  3. Here is link to photoshop color operation, writed to GLSL. Photoshop math with GLSL shaders + sample crossprocessing-shader
  4. Change BindTexture( palette , 1 ); to BindTexture( palette , 0 );
  5. 1) Look like you have assigned palette texture to TMU 1 and in you shader you have used only TMU 0. 2) shader is case sensitive, default names for TMU are texture0 - texture32, when you use BindTexture command. (Wiki: BindTexture)
  6. exec lesdk.exe and update. All what was changed, will be returned to default.
  7. Strictly speaking - each object when is rotated, translated, ... , has oriented toward Z axis vector. For example TurnEntity(e,Vec3(0,0,1)) - move entity in Z axis direction. Camera works same. Your look direction is Z axis direction, oriented by actual camera/entity rotation.
  8. AndyGFX

    error

    Globaly this talk, that you have used variable which isn't instance or isn't declared/defined in called script. Try add: whatever = {} when 'whatever' is you variable.
  9. - try change Linear offset and Multiplicative offset properties on light, - or change light position - or change light to static shadow
  10. Is it extra app or WebApp for Safari? When you need more testers, I have iPhone too
  11. Key codes are not problem, when i execute scene in Editor only with lua code (source is in post #3), then works, message is received and sent to target. Strange for me is, why when message is sent from lua code, why isn't received in BMX code too. I don't need make response in lua, i need read this message only in main BMX code. Main question is, is possible send message in LUA and RECEIVE in BMX code? I have tested SEND/RECEIVE in LUA - works, BMX too. From LUA to BMX doesn't work or i have realy issue. EDIT: Yes, works now. key constans i had included in lua, but BMX don't execute main lua script where I had this one. Many thanks.
  12. Little bug: page 37: icon is in DDS file format not gmf in Example frame
  13. Entity func_gamecontrol is now linked to this player entity in editor ... require("scripts/class") local class=CreateClass(...) function class:InitDialog(grid) self.super:InitDialog(grid) end function class:CreateObject(model) local object=self.super:CreateObject(model) object.model.mass = 1.0 object.classname = "player_model" object.last_message = "" object.receive_is_locked = 0 object.step = 0.05 object.move_step = 0 object.move_distance = 0 object.max_distance = 1.0 object.turn = 4.0 object.turn_step = 0 object.turn_angle = 0 object.max_angle = 90 object.local_y_angle=0 object.wheel_left = LoadModel("abstract::player_car_wheel.gmf") object.wheel_right = LoadModel("abstract::player_car_wheel.gmf") local body_pos = Vec3(0,0,0) --object.model:GetPosition() local body_wheel_left = Vec3(body_pos.x+0.32,body_pos.y+0.25,body_pos.z) local body_wheel_right = Vec3(body_pos.x-0.32,body_pos.y+0.25,body_pos.z) object.wheel_right:SetPosition(body_wheel_right) object.wheel_right:SetParent(object.model) object.wheel_left:SetPosition(body_wheel_left) object.wheel_left:SetParent(object.model) end and in BMX now i tried assign callback direct to target entity, which is entity with classname "player_model" 'LEVEL CCLASS ... Self.Player.CreatePlayerFromLevel(Level.GetByClassName("func_gamecontrol")) ' <- return scene entity with classname="func_gamecontrol" ' PLAYER CLASS ... Method CreatePlayerFromLevel(e:TEntity) Local e_player:TEntity = GetEntityTarget(e, 0) SetEntityCallback(e_player, Byte Ptr MyMessageReceiveCallback, ENTITYCALLBACK_MESSAGERECEIVE) End Method ... End Type Function MyMessageReceiveCallback(entity:TEntity, message:String, extra:Object) If entity Then Print(message) End If End Function I tried retype entity e_player to TBody and to TModel too. Alls with same result as before.
  14. Isn't problem ... Lua script: require("scripts/class") local class=CreateClass(...) function class:InitDialog(grid) self.super:InitDialog(grid) group = grid:AddGroup("Key Binding") group:AddProperty("key_forward", PROPERTY_STRING, "","Key Forward") group:AddProperty("key_backward", PROPERTY_STRING, "","Key Backward") group:AddProperty("key_turn_left", PROPERTY_STRING, "","Key Turn left") group:AddProperty("key_turn_right", PROPERTY_STRING, "","Key Turn right") end function class:CreateObject(model) local object=self.super:CreateObject(model) object.classname = "func_gamecontrol" -- default key binds object.key_forward = "KEY_UP" object.key_backward = "KEY_DOWN" object.key_turn_left = "KEY_LEFT" object.key_turn_right = "KEY_RIGHT" function object:SetKey(key,value) if key=="key_forward" then object.key_forward = value elseif key=="key_backward" then object.key_backward = value elseif key=="key_turn_left" then object.key_turn_left = value elseif key=="key_turn_right" then object.key_turn_right = value else return self.super:SetKey(key,value) end return 1 end function object:GetKey(key,value) if key=="key_forward" then return object.key_forward elseif key=="key_backward" then return object.key_backward elseif key=="key_turn_left" then return object.key_turn_left elseif key=="key_turn_right" then return object.key_turn_right else return self.super:GetKey(key,value) end return value end function object:Update() if GetGlobalString("LE_Environment_mode") == "ENV_MODE_GAME" then t = model:GetTarget(0) if KeyHit(_G[object.key_forward])==1 then t:SendMessage("move_forward") AppLog("move_forward") end if KeyHit(_G[object.key_backward])==1 then t:SendMessage("move_backward") end if KeyHit(_G[object.key_turn_left])==1 then t:SendMessage("turn_left") end if KeyHit(_G[object.key_turn_right])==1 then t:SendMessage("turn_right") end end end end BMX part: ... SetEntityCallback(Target, Byte Ptr MyMessageReceiveCallback, ENTITYCALLBACK_MESSAGERECEIVE) ... Function MyMessageReceiveCallback(entity:TEntity, message:String, extra:Object) If Entity Then Print(message) End If End Function where Target is target entity linked to player entity in editor and readed to from func_gamecontrol entity.
  15. I have created entity function with send message method to target object. Now i need receive this message but from BMX. Note: When I tried send/receive message only with LUA - works very good. But send message from lua and receive to bmx doesn't work for me. Any ideas?
  16. I had same problem, ... because i forgot add functions for read and write values for user defined properties. Here is part of my code. I think that help you. function class:InitDialog(grid) self.super:InitDialog(grid) group = grid:AddGroup("GameProperties") group:AddProperty("classname", PROPERTY_STRING, "classname") group = grid:AddGroup("Key Binding") group:AddProperty("key_forward", PROPERTY_STRING, "KEY_UP","Key Forward") group:AddProperty("key_backward", PROPERTY_STRING, "","Key Backward") group:AddProperty("key_turn_left", PROPERTY_STRING, "","Key Turn left") group:AddProperty("key_turn_right", PROPERTY_STRING, "","Key Turn right") end function class:CreateObject(model) local object=self.super:CreateObject(model) object.classname = "func_gamecontrol" -- default key binds object.key_forward = "KEY_UP" object.key_backward = "KEY_DOWN" object.key_turn_left = "KEY_LEFT" object.key_turn_right = "KEY_RIGHT" function object:SetKey(key,value) if key=="classname" then object.classname = value elseif key=="key_forward" then object.key_forward = value elseif key=="key_backward" then object.key_backward = value elseif key=="key_turn_left" then object.key_turn_left = value elseif key=="key_turn_right" then object.key_turn_right = value else return self.super:SetKey(key,value) end return 1 end function object:GetKey(key,value) if key=="classname" then return object.classname elseif key=="key_forward" then return object.key_forward elseif key=="key_backward" then return object.key_backward elseif key=="key_turn_left" then return object.key_turn_left elseif key=="key_turn_right" then return object.key_turn_right else return self.super:GetKey(key,value) end return value end ...
  17. Use AppSpeed() for same speed on different PC. More here: AppSPeed()
  18. A few days ago I found,that when exist ini file and lua in same folder as model, then collision doesn't work. Try remove ini file (it's old feature) and add your setup only to lua.
  19. or when you want wait to end of executed program, try this: ... 'Execute application Local process:TProcess = CreateProcess(app) Repeat Local error:String = process.err.ReadLine() If error <> "" Then Notify error EndIf If process.Status() = 0 Then Exit Forever ... Where app is path/name of exec. program.
  20. I think that this link, help you. Third person camera - ball game example
  21. I have same result - FB option missing.
  22. When you have done above post and problem still, try rebuild leadwerks mod. bmk makemods leadwers from bin folder of blitzmax folder. this help you
  23. This little sample shows how-to and when is possible call function/method with . and when with : -- | --------------------------------------------------------------------------- -- | Define class name -- | --------------------------------------------------------------------------- TMyClass = {} -- | --------------------------------------------------------------------------- -- | Define class properties -- | --------------------------------------------------------------------------- TMyClassProp = { var1 = 10, var2 = null, my_fnc = function (a) print(a) end } -- | --------------------------------------------------------------------------- -- | CONSTRUCTOR -- | --------------------------------------------------------------------------- function TMyClass:New() o = TMyClassProp setmetatable(o, self) self.__index = self return o end -- | --------------------------------------------------------------------------- -- | Method #1 -- | --------------------------------------------------------------------------- function TMyClass:SetVar1(v1) self.var1 = v1 end -- | --------------------------------------------------------------------------- -- | Method #2 -- | --------------------------------------------------------------------------- TMyClass.SetVar3 = function (v1) TMyClass.var1 = v1 print(TMyClass.var1) end -- | --------------------------------------------------------------------------- -- | Method #3 -- | --------------------------------------------------------------------------- function TMyClass:GetVar1(v1) return self.var1 end -- ***************************************************************************** -- USING -- ***************************************************************************** -- create instance of TMyClass myClass = TMyClass:New() -- call class method myClass:SetVar1(100) -- direct acces myClass.var2 = 101 -- test result print (myClass:GetVar1()) print (myClass.var2) print (myClass.SetVar3(222)) myClass.my_fnc(123) Note: Every functions in LUA are values. More here: Lua Functions
×
×
  • Create New...