Results 1 to 1 of 1

Thread: "Unknown LUA error" ?!? Switching Camera works fine but log shows error?

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Peasant
    Join Date
    Jan 2011
    Location
    Udaipur, Rajastan, India
    Posts
    5

    Default "Unknown LUA error" ?!? Switching Camera works fine but log shows error?

    Hello Seth and the Novashell community!
    I was working on a little exercise project involving two characters.

    First Character is a human , the Entity is named "Player" (Set in the lua script itself)
    Human is controlled by WASD keys. A and D to move, S to open doors and W to jump.

    Second Character is a monkey, the Entity is named "Monkey" (SetName thing in the lua script itself)

    I added key bindings to switch the Camera, R for the Human, T for the Monkey.

    When I press R, the Camera switches to the Human, and a log message shows up.
    When L is pressed, the Camera switches to the Monkey, and a similar log message shows up.

    There are no bugs or glitches in the system, the only thing that is bothering me is the log message.

    The log:
    Code:
    Original screensize detected as 1280.00 X 768.00
    Found "Logitech Attack 3", 11 buttons.
    
    Initializing GameLogic...
    Clanlib Sound System Initialized
    Mounting world path worlds/Boku_to_Sarukun.
    Novashell V0.84 and Lua 5.13 RT Edition Initted.
    Initting world
    Initting intro menu
    Loaded map Intro at tick 4074.  6 non-empty chunks, size is 2 by 2.
    Resetting!
    Clearing all maps
    User profile path now D:\Game Files\Novashell/profiles/Player/Boku_to_Sarukun
    Loaded map Main at tick 0.  46 non-empty chunks, size is 22 by 1.
    Inserting interface..
    Initting interface
    Setting up overlays..
    Loaded map System Palette at tick 0.  5 non-empty chunks, size is 2 by 1.
    Found player in Main at X:368.00 Y: -128.00
    Switching world focus to ourself?
    Initializing the player entity.
    Initializing the monkey.
    Editor opened up
    Setting retail to	false
    Editor closed
    Brain: Unknown LUA error (Invalid return type maybe?) in Entity 330 (Monkey) : OnCameraSwitch
    Brain: Unknown LUA error (Invalid return type maybe?) in Entity 330 (Monkey) : OnCameraSwitch
    Brain: Unknown LUA error (Invalid return type maybe?) in Entity 329 (Player) : OnCameraSwitch
    Brain: Unknown LUA error (Invalid return type maybe?) in Entity 329 (Player) : OnCameraSwitch
    Editor opened up
    Setting retail to	false
    Editor closed
    player.lua , SetDefaults function.
    Code:
    function SetDefaults()
    
    //--entity stuff
    	this:SetCategory(C_CATEGORY_ENTITY, false);
    	this:SetCategory(C_CATEGORY_PLAYER, true);
    	this:SetName("Player");
    	this:SetCollisionListenCategory(C_CATEGORY_TILEPIC, true);
    	this:SetCollisionListenCategory(C_CATEGORY_ENTITY, true);
    	this:GetBrainManager():Add("StandardBase","");
    	this:GetBrainManager():SendToBrainBase("control_filtery=0");
    	
    	GetGameLogic:SetPlayer(this); // <<<<<THIS WAS ADDED
    	AssignPlayerToCameraIfNeeded(); //<<<Tried removing this and using it in the switch function
    
    //--[[
    //other stuff
    
    //]]--
    
    
    
    	ResetKeys()
    end

    player.lua , SetupInputKeys function,
    This line was added
    Code:
    	GetInputManager:AddBinding("r,always", "OnCameraSwitch", this:GetID());
    monkey.lua does not have the extra added part in SetDefaults
    This line was added to the SetupInputKeys for the monkey script
    Code:
    	GetInputManager:AddBinding("t,always", "OnCameraSwitch", this:GetID());

    This is how the OnCameraSwitch looks for both player.lua AND monkey.lua -

    Code:
    --
    function OnCameraSwitch()
    	
    	GetCamera:SetEntityTrackingByID(this:GetID());
    	
    end
    --

    EDIT: I fixed it. Mods may close this thread now, sorry for inconvenience.

    The function now looks like this-
    Code:
    function OnCameraSwitch()
    	
    	GetCamera:SetEntityTrackingByID(this:GetID());
    	
    	return true;
    end
    Adding a "return true;" seemed to resolve the problem.
    Last edited by Tathagat Singh; 04-18-2014 at 03:26 AM. Reason: Resolved

Similar Threads

  1. The Glitch "Unknown" Part 2
    By Snowcone in forum Fan Creations
    Replies: 2
    Last Post: 04-20-2014, 11:53 AM
  2. Taking roles for my new story "The Unknown"
    By The11Who in forum Fan Creations
    Replies: 2
    Last Post: 05-14-2013, 08:51 AM
  3. Replies: 1
    Last Post: 03-14-2013, 07:48 AM
  4. Error compiling "Display" solution
    By user in forum Official ClanLib SDK Forums
    Replies: 3
    Last Post: 01-16-2011, 05:42 PM
  5. Replies: 5
    Last Post: 07-06-2009, 01:35 PM

Bookmarks

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •