Jump to content

AndyGFX

Members
  • Posts

    124
  • Joined

  • Last visited

Everything posted by AndyGFX

  1. A few minuts ago, i tried update from LESDK, but upload crash with: 2 files to update. Downloading "Maps/deserthighway_alpha.dds"... Downloading "Maps/terrain_arctic_alpha.dds"... File "Maps/deserthighway_alpha.dds" does not match server file size. Server says it should be 16777376 bytes, but the downloaded file is 0 bytes. File "Maps/terrain_arctic_alpha.dds" does not match server file size. Server says it should be 16777376 bytes, but the downloaded file is 0 bytes. Update completed in 7 seconds.
  2. When you want call existing function in lua script you need add to BMX code this part: C sample: http://www.lua.org/manual/2.1/subsection3_7_6.html DELPHI sample: // call LUA function function ExecuteFunction(functionname: pchar): pchar; begin if (enabled = false) then exit; lua_getglobal(VM, functionname); lua_call(VM, 0, 1); result := lua_tostring(VM, 1); //result:=0; end; // call LUA function with int arg function ExecuteFunction(functionname: pchar;val:integer): pchar; var state:integer; begin lua_getglobal(VM, functionname); state := lua_type(VM,-1); lua_pushnumber(VM, val); if (state=LUA_TFUNCTION) then lua_call(VM, 1, 0); end; And at end, my TIP: - add PUB.LUA to your BMX source - then you have this very useful functions added: Function lua_dobuffer:Int (lua_state:Byte Ptr, buff:String, sz:Int, name:String) Function lua_dofile:Int (lua_state:Byte Ptr, filename:String) Function lua_dostring:Int (lua_state:Byte Ptr, str:String) and many others.
  3. Q#1: Why you don't write string to a file and then call with RunScript? Q#2: Why you have inserted XML between Lua script and BMX? Why you don't write your class Item like lua class? TItemClass = {} function TItemClass:New() o = { bItem_Used = false } setmetatable(o, self) self.__index = self return o end function TItemClass:OnPick() self.light = CreateSpotLight() self.light:Hide() end function TItemClass:OnUseSwitch() if (self.bItem_Used==true) then self.light:Show() else self.light:Hide() end end function TItemClass:OnUpdate() -- ... end
  4. File Name:Save data to lua syntax (as text/compressed) File Submitter: AndyGFX File Submitted: 01 Jun 2010 File Updated: 01 Jun 2010 File Category: Lua Scripts I wrote TStoreData.lua class for simple save data to standard lua format, which is simple to read back to script (described here: HowTo using LUA script as data file) Example: Save Data require ("class/TStoreData") test_data = { pos = {0,1,2}, name = "player1", other = { items = {"item1","item2","item3"}, subitems = {"A","B"}, data = { x = 0, y = 1, z= 2}, tree = { leaf1 = "l1", leaf2 = "2", leaf3 = { leaf31 = "31", leaf32 = "32"}, used = true } } } DataSaver = TStoreData:New() -- save uncompressed data DataSaver:Save("result.lua",false,test_data) -- save compressed data -- DataSaver:Save("result.lua",true,test_data) Output: return { ["other"] = { ["items"] = { [1] = "item1"; [2] = "item2"; [3] = "item3"; }; ["subitems"] = { [1] = "A"; [2] = "B"; }; ["data"] = { ["y"] = 1; ["x"] = 0; ["z"] = 2; }; ["tree"] = { ["used"] = true; ["leaf3"] = { ["leaf32"] = "32"; ["leaf31"] = "31"; }; ["leaf1"] = "l1"; ["leaf2"] = "2"; }; }; ["name"] = "player1"; ["pos"] = { [1] = 0; [2] = 1; [3] = 2; }; } Example#1: Load Data GameData = dofile("result.lua") print(GameData.pos[1],GameData.pos[2],GameData.pos[3]) print(GameData.name) print(GameData.other.items[1]) print(GameData.other.items[2]) print(GameData.other.items[3]) Example#2: Load Data require ("class/TStoreData") LoadData = TStoreData:New() GameData = LoadData:Load("result.lua") print(GameData.pos[1],GameData.pos[2],GameData.pos[3]) print(GameData.name) print(GameData.other.items[1]) print(GameData.other.items[2]) print(GameData.other.items[3]) Note: Saved format looks little bit different, but this saved format is only other lua syntax. Work same like before. Click here to download this file
  5. AppLog(str text, int flags) where flag is: APPLOG_ERROR APPLOG_NORMAL APPLOG_WARNING Command is same for Lua/BMX/C++
  6. AndyGFX

    Emitter

    Second strange thing is, why bullet.lua with cyclemode=1 works (is used in fpscontroller.lua). ... if pick~=nil then SetWorld(fw.transparency.world) emitter=CreateEmitter(5,700,pick.normal,1) emitter:SetVelocity( pick.normal ) emitter:SetRadius(0.1,0.5) emitter:SetWaver(10) emitter:SetColorf(0.5,0.5,0.5,0.1) emitter:Paint(material_impactdust) emitter:SetPosition( pick.position ) emitter:SetRotationSpeed(0.1) SetWorld(fw.main.world) ... Note: Looks like for Lua LE API is this issue fixed.
  7. AndyGFX

    Emitter

    Try change alpha color to 0.0125 with 80 particles, and then same alpha with only one particle. particle2 = CreateEmitter(80, 500, Vec3(0, 4, 0), 1) EntityColor(particle2, Vec4(1, 0.5, 0.25, 0.0125)) particle2 = CreateEmitter(1, 500, Vec3(0, 4, 0), 1) EntityColor(particle2, Vec4(1, 0.5, 0.25, 0.0125)) Edit: Because emitter is moved in same velocity as is defined for particles nodes, then all new particles are created on actual node position and sum of all alpha is >1 => without transparency.
  8. AndyGFX

    Emitter

    The "seems brighter" is, because all 80 particles are created on same place, and for this I think, that is bug.
  9. AndyGFX

    Emitter

    Any news about this ... ?
  10. of course method #1 os.execute("luac -o game.data game.lua") method #2 os.execute("path to bat file, where bat file contains luac ....") EDIT: When you haven't installed full LUA libs for windows, use this link http://code.google.com/p/luaforwindows/downloads/detail?name=LuaForWindows_v5.1.4-37.exe'>http://code.google.com/p/luaforwindows/downloads/detail?name=LuaForWindows_v5.1.4-37.exe from main page: http://code.google.com/p/luaforwindows/
  11. int Global 0 = local space , 1 = global space http://www.leadwerks.com/wiki/index.php?title=Entities#PositionEntity
  12. "Apply" button and checkbox [x] Autoupdate
  13. AndyGFX

    Laser beam

    @Joh: When you need BEAM type sprite, best way is write "Axis Aligned Billboard" i have this code writed in Pascal, BMX and for Java, when you want I send you my code, or from this link AAB is in C++. EDIT: Why wait, when you need it, here are my codes: Axis Aligned Billboard (Pascal, Bmx, Java ))
  14. TGLFont instead TFont Font1:TGLFont=LoadFont(...)
  15. Loaded color scheme isn't applied on Editor.
  16. Isn't comlicated. Example Base screen resolution = 1024x768 (HUD is designed for this res.) User defined resolution after start is now: 1280x1024 Math (new_res/base_res): hud_x_scale = 1280/1024 hud_y_scale = 1024/768 and for all HUD elements you need calc new position: new_x = hud_x_scale * item_x new_y = hud_y_scale * item_y and size: new_w = hud_x_scale * item_w new_h = hud_y_scale * item_h and draw it. Note: You don't need create different images when are designed for max resolution.
  17. You need calc scale coef. for base screen resolution, then draw all HUD items multiplied by new scale (position and size).
  18. Sample data file [game.lua]: return { pos = {0,1,2}, name = "player1", other = { items = {"item1","item1","item1"} } } call in code: GameData = dofile("game.lua") -- test data print(GameData.pos[1],GameData.pos[2],GameData.pos[3]) print(GameData.name) print(GameData.other.items[1]) print(GameData.other.items[2]) print(GameData.other.items[3]) Note: When your data are static, then is possible compile file to binary format: luac -o game.data game.lua, but then you don't forget change filename in your code, when output filename isn't same.
  19. Here is simple example, howto compile lua scripts into single file (good for distribution) when you can't distribute lua source. Download: Sample LUAC command line: luac -o <output lua filename>.<your extension> <main lua script filename> <additional lua scripts #1> <additional lua scripts #2> ... <additional lua scripts #n> sample: luac -o main_lua.bin main_lua.lua scripts/script1.lua scripts/script3.lua scripts/script2.lua or luac -o main_lua.bin main_lua.lua scripts/*.lua Note: don't use script extension with require command.
  20. Other option for loading data to lua from text file, is command dofile, where loaded file has format like this: file "game.data": return { pos = {0,1,2}, name = "player1", other = { items = {"item1","item1","item1"} } } then in your script call: GameData = dofile("game.data") Chceck data: print(GameData.pos[1],GameData.pos[2],GameData.pos[3]) print(GameData.name) print(GameData.other.items[1]) print(GameData.other.items[2]) print(GameData.other.items[3]) Benefit is, that you don't need write parser for data. EDIT: When you need data more secure, then compile your game data file with: luac -o game.cdata game.data your data are in binary format now, and simply change loading to GameData = dofile("game.cdata"). Note: Compiled data are good only for static data like startup setting, scene properties, addons, items descr., ...
  21. AndyGFX

    Emitter

    I have used same code for two emitters, difference is only in parameter CYCLEMODE, but result looks like bug, because Emitter position is moved in Velocity vector too, when is cyclemode set to 1. Is it bug? (From my point of view - yes) but I waiting for confirmation from others. Then i write bug to bugtracker, when yes. Function Fire() Local particle:TEmitter setWorld(fw.transparency.world) particle = CreateEmitter(80, 500, Vec3(0, 4, 0), 0) particle.SetPosition(Vec3(-1, 0, 0)) particle.SetRotation(Vec3(0, 0, 0)) EntityColor(particle, Vec4(1, 0.5, 0.25, 0.5)) PaintEntity(particle, LoadMaterial("abstract::fire.mat")) SetEmitterRadius(particle, 0.1, 0.5) SetEmitterRotationSpeed(particle, 0.2) setWorld(fw.Main.world) Local particle2:TEmitter setWorld(fw.transparency.world) particle2 = CreateEmitter(80, 500, Vec3(0, 4, 0), 1) particle2.SetPosition(Vec3(1, 0, 0)) particle2.SetRotation(Vec3(0, 0, 0)) EntityColor(particle2, Vec4(1, 0.5, 0.25, 0.5)) PaintEntity(particle2, LoadMaterial("abstract::fire.mat")) SetEmitterRadius(particle2, 0.1, 0.5) SetEmitterRotationSpeed(particle2, 0.2) setWorld(fw.Main.world) End Function
  22. Try this my hint: - when you press move control, define movement vector for player not from model (Z axis vector), but from camera axis vectors, because camera is always oriented toward screen and looks on level/player from side when we talk about "side scroll" control. Pseudo math code for movement: to right/left: Pivot_pos = Pivot_pos +/- Camera_X_axis_vetor to up/down: Pivot_pos = Pivot_pos +/- Camera_Z_axis_vetor with this, player movement always looks like "side scroll", aligned to camera view.
×
×
  • Create New...