ToME: the Tales of Maj'Eyal

Everything about ToME
It is currently Wed Aug 15, 2018 2:22 pm

All times are UTC




Post new topic Reply to topic  [ 11 posts ] 
Author Message
PostPosted: Sat Mar 19, 2016 3:48 pm 
Offline
Wayist

Joined: Sat Mar 19, 2016 3:38 pm
Posts: 23
So I tried to add a line from the guides to the example module

body = { INVEN = 1000, MAINHAND=1, OFFHAND=1, BODY=1, QUIVER=1 },

To the base player descriptor. It makes the module crash or hang after role selection.

Anybody got any idea why?

The error message talks about engine lua files, not module lua files.


Top
 Profile  
 
PostPosted: Sun Mar 20, 2016 3:08 am 
Offline
Thalore

Joined: Mon Mar 25, 2013 10:09 pm
Posts: 153
What error messages are you getting in your te4_log.txt?

_________________
Qi Daozei (QDZ) - an Oriental-themed fantasy game for T-Engine. ToME Tips - auto-generated spoilers for ToME.


Top
 Profile  
 
PostPosted: Sun Mar 20, 2016 3:42 am 
Offline
Wayist

Joined: Sat Mar 19, 2016 3:38 pm
Posts: 23
Had to erase previous log and reproduce it but here they are:

Code:
[BIRTHER] Applying descriptor base
Lua Error: /engine/Birther.lua:421: attempt to call method 'initBody' (a nil value)
   At [C]:-1 initBody
   At /engine/Birther.lua:421 apply
   At /engine/Birther.lua:308 next
   At /engine/Birther.lua:135 fct
   At /engine/ui/ListColumns.lua:463 onUse
   At /engine/ui/ListColumns.lua:135 fct
   At /engine/Mouse.lua:58 receiveMouse
   At /engine/Mouse.lua:98 delegate
   At /engine/ui/Dialog.lua:657 mouseEvent
   At /engine/ui/Dialog.lua:399 fct
   At /engine/Mouse.lua:58


The base descriptor I tried to implement:
Code:
newBirthDescriptor{
   type = "base",
   name = "base",
   desc = {
   },
   experience = 1.0,
   --let's hope the following line doesn't crash everything
   --It did. Maybe multiple slots of the same name are guilty?
   --body = { INVEN = 12, MAINHAND=1, OFFHAND=1, UNDER=1, ARMOR=1, OVER=1, MISC=1 }
   body = { INVEN = 1000, MAINHAND=1, OFFHAND=1, BODY=1, QUIVER=1 },

   copy = {
      max_level = 10,
      lite = 4,
      max_life = 25,
   },
}


My best guess now that I have found the error log is that I can't say "body" here without doing something else somewhere else, but I have no clues as to what. I'll try to look up something helpful on the reference but I'm not going to hold my breath... :(


Top
 Profile  
 
PostPosted: Sun Mar 20, 2016 11:28 am 
Offline
Archmage

Joined: Tue Jun 18, 2013 7:24 pm
Posts: 449
Look in the te4 wiki. You need to require ActorInventory.

_________________
Working on a T-Engine game
Veins of the Earth

Veins of the Earth ModDB page


Top
 Profile  
 
PostPosted: Sun Mar 20, 2016 3:10 pm 
Offline
Wayist

Joined: Sat Mar 19, 2016 3:38 pm
Posts: 23
Damn, yes.

Even with a warning that it's NOT done in the example module. Reading stuff late at night, you miss and forget things.

Edit:
I did require ActorInventory and tried to define inventory slots in load.lua

Code:
local ActorInventory = require "engine.interface.ActorInventory"


It still freezes with the same errors (attempt to call initBody with a nil value)


Top
 Profile  
 
PostPosted: Mon Mar 21, 2016 12:41 am 
Offline
Perspiring Physicist

Joined: Sun Sep 09, 2012 7:43 am
Posts: 5742
Then stop calling initBody with a nil value. :P

What are you calling initBody with and are you sure every variable is defined?

_________________
My feedback meter decays into coding. Give me feedback and I make mods.


Top
 Profile  
 
PostPosted: Mon Mar 21, 2016 1:26 am 
Offline
Thalore

Joined: Mon Mar 25, 2013 10:09 pm
Posts: 153
Are you sure you've read the error correctly and followed the wiki correctly?

Quote:
Code:
[BIRTHER] Applying descriptor base
Lua Error: /engine/Birther.lua:421: attempt to call method 'initBody' (a nil value)

This means that initBody is nil (i.e., you have no initBody method).

Quote:
It still freezes with the same errors (attempt to call initBody with a nil value)

This means that a parameter to initBody is nil - that's a very different error.

If initBody itself is nil, and if all you've done is require ActorInventory:

Code:
local ActorInventory = require "engine.interface.ActorInventory"

Then it sounds like you missed the step in the Objects Howto Guide of editing mod/class/Actor.lua and adding engine.interface.ActorInventory to its inheritances.

_________________
Qi Daozei (QDZ) - an Oriental-themed fantasy game for T-Engine. ToME Tips - auto-generated spoilers for ToME.


Top
 Profile  
 
PostPosted: Tue Mar 22, 2016 6:55 pm 
Offline
Wayist

Joined: Sat Mar 19, 2016 3:38 pm
Posts: 23
Castler wrote:
Are you sure you've read the error correctly and followed the wiki correctly?

Quote:
Code:
[BIRTHER] Applying descriptor base
Lua Error: /engine/Birther.lua:421: attempt to call method 'initBody' (a nil value)

This means that initBody is nil (i.e., you have no initBody method).

Quote:
It still freezes with the same errors (attempt to call initBody with a nil value)

This means that a parameter to initBody is nil - that's a very different error.

If initBody itself is nil, and if all you've done is require ActorInventory:

Code:
local ActorInventory = require "engine.interface.ActorInventory"

Then it sounds like you missed the step in the Objects Howto Guide of editing mod/class/Actor.lua and adding engine.interface.ActorInventory to its inheritances.


It was the first kind of error, thanks for your reply, I kept following the wiki and got rid of that crash.

Sorry if I seem a bit stupid but I really only have a cursory understanding of programming.


Top
 Profile  
 
PostPosted: Wed Mar 23, 2016 3:03 pm 
Offline
Wyrmic

Joined: Sat Dec 13, 2014 3:38 pm
Posts: 287
Don't worry, the worst you get with ToME4 programming is lua errors and the module or addon not loading. Most error messages you get give you a good idea what you need to fix. Trial and error, no-one is expecting you to be perfect. You get better as you go. :)


Top
 Profile  
 
PostPosted: Wed Mar 23, 2016 3:28 pm 
Offline
Wayist

Joined: Sat Mar 19, 2016 3:38 pm
Posts: 23
Thanks, yeah, I'm starting to feel my way around those error reports.


Top
 Profile  
 
PostPosted: Sun Mar 27, 2016 12:00 am 
Offline
Wayist

Joined: Sat Mar 19, 2016 3:38 pm
Posts: 23
Resolved, this thread can be closed.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 11 posts ] 

All times are UTC


Who is online

Users browsing this forum: No registered users and 2 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group