Need help with debuglog from map_to_file

Winterbay

Active member
I am poking a bit at batbrain related things and gettign incombat restoration to an acceptable level (to me). I am testing a few things and have exported the opts-map that batbrain generates into a textfile that I load, sort and then tried to export again but I got a debug log.

The script snippet I used is:
Code:
typedef int[stat] substats;
typedef float[element] spread;
record advevent
{ 
	string id; 
	spread dmg; 
	float att; 
	float def; 
	float stun; 
	float hp; 
	float mp; 
	float meat; 
	substats stats;
};
advevent[int] opts; 
string[int] split;
file_to_map("SAwholemap.txt", opts); 
sort opts by -value.mp;
map_to_file(opts, "SAwholemapS.txt");
foreach i in opts
{
	print(i + ": " + opts[i].id);
}

Debuglog and textfile (for replication) attached.

Anyone got an idea what I just did?
 

Winterbay

Active member
Noone who can explain what happened? Is it just not possible to export to a map so fast after you imported it?
 

Winterbay

Active member
I could do that, so I did, and it didn't work.
Code:
Imported map
Countdown: 20 seconds...
Countdown: 15 seconds...
Countdown: 10 seconds...
Countdown: 5 seconds...
Countdown: 4 seconds...
Countdown: 3 seconds...
Countdown: 2 seconds...
Countdown: 1 second...
Waiting completed.
Unexpected error, debug log printed.

With the same kind of debug report (only difference I can see is an additional line of "at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)" after the other two sun.reflect-lines.

Also added error catching around the import and export-parts but that did not help.

Edit:
Added some more printing to see if anything actually happened in my sort and it appears to.
Code:
> call scripts\my scripts\test.ash

Imported map
Printing the unsotred map
0: skill 4005
1: skill 1003
2: skill 1005
3: skill 4003
4: skill 4020
5: attack
6: jiggle
7: use 2
8: use 563
9: use 1705
10: use 3119
11: use 3120
12: use 3118
13: use 1059
14: use 559
15: use 747
16: use 181
17: skill 1023
18: skill 3004
19: skill 3009
20: skill 4014
21: use 469
22: use 208
23: use 1922
24: use 518
25: use 27
26: use 1965
27: use 466
28: use 1958
29: use 2091
30: use 452
31: use 464
32: use 2438
Printing the sorted map
0: use 466
1: use 518
2: skill 4020
3: attack
4: jiggle
5: use 2
6: use 563
7: use 1705
8: use 3119
9: use 3120
10: use 3118
11: use 1059
12: use 559
13: use 747
14: use 181
15: use 469
16: use 208
17: use 1922
18: use 27
19: use 1965
20: use 1958
21: use 2091
22: use 452
23: use 464
24: use 2438
25: skill 1003
26: skill 4003
27: skill 3004
28: skill 4014
29: skill 3009
30: skill 1005
31: skill 4005
32: skill 1023
Unexpected error, debug log printed.
 
Last edited:

slyz

Developer
It works if you remove the "dmg" and "stats" entries from the record and from the data file.

EDIT: if you replace your record definition by this:
PHP:
record advevent
{ 
	string id; 
	float[element] dmg; 
	float att; 
	float def; 
	float stun; 
	float hp; 
	float mp; 
	float meat; 
	int[stat] stats;
};
this error comes up:
Code:
Invalid line in data file: "0 skill 4005 0.0 0.0 0.0 0.0 -8.0 0.0 " (test.ash, line 17)
Invalid key in data file: skill 4005

I guess using a typedef was preventing Mafia from correctly pointing out the problem in the data file.
 
Last edited:

Winterbay

Active member
Thank you! Now I just need to figure out why those are missing and if that matters anywhere else that isn't exporting the map (probaby not) :)
 

slyz

Developer
I think this is what each entry in your data file should look like (here with default values everywhere):
Code:
0	id	test
0	dmg	none	0.0
0	att	0.0
0	def	0.0
0	stun	0.0
0	hp	0.0
0	mp	0.0
0	meat	0.0
0	stats	none	0
 

Winterbay

Active member
Yeah, the problem is that the original datafile was created by data imported from Batbrain so I did not really have anythign to say about what was in that one. And the exporting was mainly done to see how the map looked after sorting and not for any practical reason so if that is the only thing that fails then it's not much of a problem anyway (I'm only looking for the hp and mp fields trying to deduce which restoration items are best to use in a fight).
 
Top