Page 1 of 1

Character dump

Posted: Thu Jul 01, 2010 5:35 am
by shani
I started working on a more presentable character dump (I thought of an XML file with XSLT transformation,
but that can be optional since it's an overkill :lol: )
Anyways, How can I rertrieve the inventory? I can't seem to find anything in ActoryInventory
and showing only the '.combat' properties seems lacking...

Re: Character dump

Posted: Thu Jul 01, 2010 1:16 pm
by Shoob
have a look starting at line 123 of game/engine/dialogs/ShowEquipInven.lua

what you probably want is game.player.inven and game.player.inven_def (the first is used for inventory, the last for equipment, the above file shows how to access them).

Re: Character dump

Posted: Thu Jul 01, 2010 1:29 pm
by Antagonist
I approve of this project.

Re: Character dump

Posted: Thu Jul 01, 2010 2:28 pm
by darkgod
Ohhh thanks !

XML+XSLT yes probably too much for joe average yes ;)
But dumps should be made into both a text format and an html one IMO.

As for iterating all objects:

Code: Select all

	for inven_id, inven in pairs(actor.inven) do
		for item, o in ipairs(inven) do
			
		end
	end

Re: Character dump

Posted: Thu Jul 01, 2010 2:55 pm
by shani
No problem... I might help more after I'll finish my exams (Last exams before getting my grade, yay!!! :D )

Meanwhile, I'm working on the textual dump, the HTML one I'll do later.

Re: Character dump

Posted: Thu Jul 01, 2010 4:50 pm
by shani
Here's a Sample dump from the new dump function:

Code: Select all

  [Tome 4.00 @ www.te4.org Character Dump]

Sex              : Male         STR:  14
Race             : Hobbit       DEX:  29
Class            : Slinger      MAG:  10
Level            : 6            WIL:  10
Exp              : 49%          CUN:  20
Gold             : 8783.550000  CON:   12

Attack(Main Hand):  39          Life             :     170/170
Damage(Main Hand):   4          Stamina          :     115/115
APR   (Main Hand):   0          
Crit  (Main Hand):   5%         
Speed (Main Hand): 0.80         

  [Character Equipment]
 In main hand
a) rough leather sling
 In off hand
 On fingers
a) copper ring of dexterity (+2)
b) copper ring of defense (5 def, 0 armor)
 Around neck
a) copper amulet of cunning (+2)
 Light source
a) bright brass lantern of clear sight
 Main armor
a) rough leather armour of nature resistance (1 def, 2 armor)
 On head
 On hands
 On feet
a) pair of rough leather boots (0 def, 1 armor)
 Tool
 Quiver
a) 196 iron shot (8.5-10.2 power, 1 apr)

  [Character Inventory]
a) Blood of Life
b) acid-proof potion of lesser healing
c) giant potion of greater healing
d) 2 giant potion of lesser healing
e) 2 potion of cure poison
f) 13 potion of lesser healing
g) potion of lesser mana
h) potion of see invisible
i) potion of slime mold juice
j) 2 long scroll of identify
k) 14 scroll of identify
l) 5 scroll of light
m) scroll of magic mapping
n) 20 scroll of phase door
o) scroll of teleportation
p) elm staff
q) shimmering linen robe of lightning resistance (0 def, 0 armor)
r) 184 iron shot (8.5-10.2 power, 1 apr)
s) citrine

Fatigue          : 7%           Spellpower:   10
Armor            : 3            Spell Crit:    5%
Class            : 14.65        Spell Speed:   1
Class            : 14.65        


Physical Resist:   7
Spell Resist:      5
Mental Resist:     8

Nature Resist:  10%

Number of NPC killed: 116
Most killed NPC: giant brown mouse (9)
If you have any ideas/modifications/rants let me know.
BTW: To whom should I give/send/post the code to?

Re: Character dump

Posted: Thu Jul 01, 2010 5:17 pm
by Shoob
I would move the inventory/equipment to the very bottom of the file :P

I posted my visible monsters code to the modules forum, and I assume yours would go there too.

Re: Character dump

Posted: Thu Jul 01, 2010 5:21 pm
by shani
Good idea, moved.

Will post now code now.