Search the Community
Showing results for tags 'function'.
-
'm using the C++ SDK and lua for small objects code. I need to create the entities from C++ and later use the bool Entity::CallFunction(const std::string& functionName, Object* extra) How to 'bind' on script lua to an entity ? it looks that Interpreter is using tolua++, but I can't figure how to load the .lua properly to the object // Create 100 special entity std::vector<Entity*> list; for (int i = 0; i < 100; i ++) { Entity* entity = new MyEntity(); entity->AddToWorldTable(true ); list.push_back(entity); } // Load special script (But not working, object not callable). Interpreter::NewTable(); Interpreter::SetGlobal("Script"); // Must Script. Don't change that, because the script are prefixed with Script:myFunction if (Interpreter::ExecuteFile("MyEntity.lua")) { System::Print("Error: Failed to execute script \"" + it + "\"."); } for (auto&it : list) it->CallFunction("OnSpecialFunction") Script Lua function Script:OnSpecialFunction() print self end
-
Prefab Load Start Bug Leadwerks 4.3 CPU: AMD FX™-4100 Quad-Core Processor RAM: 8GB GRAPHICS: NVIDIA GeForce GTX 750 Ti VRAM: 2048 MB Version: 375.39 Platform: GNU/Linux Debian Jessie x86_64 Bug: When loading a prefab, the Start function does not fully work. It seems that variables are loaded, but other functions fail to operate. IE SetPosition() Below are some images displaying the different models and a prefab in the Leadwerks editor: Models and with scripts attached: Prefab: The following images show the prefab and models running in Leadwerks:
-
I'm trying to create a script that spawns an object every so often at a set time, but I keep getting a script error that says " '=' expected near 'function'". I'm new to programming and have no clue what that means. here's a screenshot of it in context. ANy help would be very appreciated. Script.spawnObject = "" --entity "Object" Script.spawnTimer = 1.5 --float "Spawn timer" Script.timer function Script:UpdateWorld() self.timer = self.timer + (Time:GetSpeed()/100) if(self.timer > self.spawnTimer) then local newObject = self.spawnObject:Instance() newObject:SetPosition(self.entity:GetPosition()) self.timer = 0 end end
-
Hai! I have a function for changing the music track in my game and it works fine and all, but I also want it to get the total length of the track... Here is my function I'm currently using: function App:SwitchMusic(name) App.source:Stop() local sound = Sound:Load("Sound/BGM/" .. name .. ".wav") App.source:SetSound(sound) App.source:Play() end I tried adding something like App.tracklength = Math:Round(self.name:GetLength()) But it only returns in an error, since I guess it's trying to find a loaded sound with the name "name" and not from the variable. Do anyone have any idea how I can solve this? Thanks! KraXarN
-
How limited are our abilities to play with Nav-Meshes? I can tell an entity to use one and be told whether its possible or not and as far as I know thats pretty much it. Can Nav-Meshes be targeted functionally? I was trying to see if I could use Camera::Pick() to know when the mouse was over a Nav-Mesh. I can have half the solution in that I can tell if the returned position is within a Nav-Mesh but I cannot guarantee that the Pick() will choose the surface with the Nav-Mesh
-
I'm not sure if this is a bug but the SetMousePosition function that takes in three parameters, the x value, y value, and z value, does not properly set the z value of the mouse position. One can test this using this code snippet. self.window = Window:GetCurrent() self.window:SetMousePosition(50.0,50.0,10.0) System:Print(self.window:GetMousePosition():ToString()) The z value still remains 0.0
- 4 replies
-
- mouse position
- function
-
(and 1 more)
Tagged with: