Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- fclose('all')
- clc
- clear
- logfile = fopen('C:\Users\Tom\Dropbox\myscript\log.txt');
- linenum=1;
- nocell =0;
- yescell=0;
- deaths =0;
- repairs =0;
- sellevent=0;
- stashed=0;
- sold=0;
- stashfull=0;
- stashfullboth=0;
- loggedout=0;
- cellarwalkfail=0;
- cellarwalkfaildeath=0;
- failcorrected=0;
- gaps=0;
- tesstimes=[];
- runtimes=[];
- sellvalues=[];
- loot = [];
- repairvalues=[];
- logtimes=[];
- cellfindpoint=[0,0,0,0,0,0,0,0];
- cellfindpointfail=[0,0,0,0,0,0,0,0];
- gaptime=0;
- lastline='';
- while ~feof(logfile)
- thisline = fgetl(logfile);
- ltime = thisline(1:19);
- ltimenum = datenum(ltime );
- if linenum == 1, lasttime = ltimenum; end
- thisline=lower(thisline(22:end));
- linerec = false;
- if findstr(thisline,'oncellar recovery success'), failcorrected=failcorrected+1;linerec = true; end
- if findstr(thisline,'oncellar recovery failure'), linerec = true; end
- if findstr(thisline,'no cell'), nocell=nocell+1;linerec = true; end
- if findstr(thisline,'died'), deaths=deaths+1;linerec = true;end
- if findstr(thisline,'sell'), sellevent=sellevent+1;linerec = true;end
- if length(thisline) >15 && strcmp('stash full using',thisline(1:16)), stashfull=stashfull+1;linerec = true;end
- if strcmp('stash full',thisline), stashfull=stashfull+1;linerec = true;end
- if length(thisline) >14 && strcmp('stash full both',thisline(1:15)), stashfullboth=stashfullboth+1;linerec = true;end
- if findstr(thisline,'logged'), loggedout=loggedout+1;linerec = true;end
- if findstr(thisline,'didnt end up')
- cellarwalkfail=cellarwalkfail+1;
- linerec = true;
- cellfindpointfail(lastfind)=cellfindpointfail(lastfind)+1;
- end
- if findstr(thisline,'died') & findstr(lastline,'didnt end up')
- cellarwalkfaildeath=cellarwalkfaildeath+1;
- linerec = true;
- end
- if findstr(thisline,'gold')
- yescell=yescell+1;
- linerec = true;
- thisloot = textscan(thisline,'gold: %d, gold delt: %d, items: %d, gems: %d, books: %d, potions: %d, goldpick: %d');
- try
- loot=[loot; double(cell2mat(thisloot))];
- catch
- %disp(thisline)
- end
- end
- if findstr(thisline,'tesseract')
- linerec = true;
- thisloot = textscan(thisline,'tesseract time: %d');
- if ~isempty(thisloot)
- tesstimes=[tesstimes;double(cell2mat(thisloot(1)))];
- end
- end
- if findstr(thisline,'cellar found')
- linerec = true;
- thisloot = textscan(thisline,'cellar found at: %d');
- if ~isempty(thisloot)
- cellfindpoint(cell2mat(thisloot(1)))=cellfindpoint(cell2mat(thisloot(1)))+1;
- lastfind=cell2mat(thisloot(1));
- end
- end
- if findstr(thisline,'sold')
- linerec = true;
- thisloot = textscan(thisline,'sold items: %d, sold value: %d');
- if ~isempty(thisloot)
- sold=sold+double(cell2mat(thisloot(1)));
- sellvalues=[sellvalues;double(cell2mat(thisloot(2)))];
- end
- end
- if findstr(thisline,'repair cost')
- linerec = true;
- thisloot = textscan(thisline,'repair cost: %d');
- repairs=repairs+1;
- if ~isempty(thisloot)
- repairvalues=[repairvalues;double(cell2mat(thisloot(1)))];
- end
- end
- if findstr(thisline,'last runtime')
- linerec = true;
- thisloot = textscan(thisline,'last runtime: %f');
- if ~isempty(thisloot)
- runtimes=[runtimes;double(cell2mat(thisloot(1)))];
- end
- end
- if findstr(thisline,'stash') & linerec == false
- linerec = true;
- thisloot = textscan(thisline,'stashed items: %d');
- if ~isempty(thisloot)
- stashed=stashed+double(cell2mat(thisloot));
- end
- end
- if ~linerec
- disp(thisline)
- end
- timed = ltimenum-lasttime;
- [~, ~, ~, ~, M, ~] = datevec(timed);
- logtimes(linenum) = ltimenum;
- if M>2
- % disp(datestr(timed,'HH:MM:SS'))
- gaps=gaps+1;
- gaptime=gaptime+timed;
- end
- lasttime = ltimenum;
- lastline = thisline;
- linenum=linenum+1;
- end
- totalruns = yescell+nocell;
- entiretime = logtimes(end)-logtimes(1)-gaptime;
- [~, ~, ~, H, M, S] = datevec(entiretime);
- totalhours = H+(M/60)+(S/3600);
- totalgold = loot(end,1)-loot(1,1);
- validgold=abs(loot(:,2)) < 20000 ;
- avggold=mean(loot( validgold ,2));
- sellvalues = sellvalues( sellvalues < 30000 & sellvalues > 300);
- avgsellval = mean(sellvalues);
- totalsell = sum(sellvalues);
- alttotal = sum(loot( validgold ,2)) + (yescell-sum(validgold))*avggold + totalsell-sum(repairvalues);
- pickfreq = cellfindpoint./sum(cellfindpoint) * 100;
- failfreq = cellfindpointfail./sum(cellfindpointfail) * 100;
- fprintf('\n')
- fprintf('Log Duration: %s, Gaps: %d, Totaling: %s\n\n',datestr(entiretime,'HH:MM:SS'),gaps,datestr(gaptime,'HH:MM:SS'))
- fprintf('Gold total: %d, Per Hour: %.2f, Per Trip: %.2f\n',floor(alttotal),alttotal/totalhours,avggold)
- %fprintf('Gold total: %d, Per Hour: %.2f, Per Trip: %.2f\n',totalgold,totalgold/totalhours,avggold)
- fprintf('Items total: %d, Per Hour: %.2f, Per Trip: %.2f, Chance %.2f%%\n',sum(loot(:,3)),sum(loot(:,3))/totalhours,mean(loot(:,3)),(1-(sum(loot(:,3)==0)/length(loot)))*100)
- fprintf('Gems total: %d, Per Hour: %.2f, Per Trip: %.2f, Chance %.2f%%\n',sum(loot(:,4)),sum(loot(:,4))/totalhours,mean(loot(:,4)),(1-(sum(loot(:,4)==0)/length(loot)))*100)
- fprintf('Books total: %d, Per Hour: %.2f, Per Trip: %.2f, Chance %.2f%%\n',sum(loot(:,5)),sum(loot(:,5))/totalhours,mean(loot(:,5)),(1-(sum(loot(:,5)==0)/length(loot)))*100)
- %fprintf('Potions total: %d, Per Hour: %.2f, Per Trip: %.2f, Chance %.2f%%\n',sum(loot(:,6)),sum(loot(:,6))/totalhours,mean(loot(:,6)),(1-(sum(loot(:,6)==0)/length(loot)))*100)
- %fprintf('GoldPick total: %d, Per Hour: %.2f, Per Trip: %.2f, Chance %.2f%%\n',sum(loot(:,7)),sum(loot(:,7))/totalhours,mean(loot(:,7)),(1-(sum(loot(:,7)==0)/length(loot)))*100)
- fprintf('\nCellar frequency (success/total runs): %d/%d: %.2f%%\n',yescell,totalruns,yescell/totalruns*100)
- fprintf('Trips per hour: Total: %.2f, Success: %.2f, Fail %.2f\n',(totalruns)/totalhours,yescell/totalhours,nocell/totalhours)
- fprintf('Avg Runtime: %.2fs, Success: %.2fs, Fail: %.2fs, Vend: %.2fs\n\n',mean(runtimes),mean(runtimes(runtimes>25 & runtimes < 50)),mean(runtimes(runtimes < 25)),mean(runtimes(runtimes > 50)))
- fprintf('Repairs total: %d, Per Hour: %.2f, Cost: %d \n',repairs,repairs/totalhours,sum(repairvalues))
- fprintf('Deaths total: %d, Per Hour: %.2f\n',deaths,deaths/totalhours)
- fprintf('Sold total: %d, Per Hour: %.2f\n',sold,sold/totalhours)
- fprintf('Stashed total: %d, Per Hour: %.2f\n',stashed,stashed/totalhours)
- fprintf('Stash full events: First tab %d, Both tabs: %d\n',stashfull,stashfullboth)
- fprintf('Logged out events: %d\n',loggedout)
- fprintf('Failed runs: %d, Due to death: %d, Corrected with fix: %d\n',cellarwalkfail,cellarwalkfaildeath,failcorrected)
- fprintf('Detect Freq: p1: %.1f%%, p2: %.1f%%, p3: %.1f%%, p4: %.1f%%\n',pickfreq(1),pickfreq(2),pickfreq(3),pickfreq(4))
- %fprintf('Detect Freq: p5: %.1f%%, p6: %.1f%%, p7: %.1f%%, p8: %.1f%%\n',pickfreq(5),pickfreq(6),pickfreq(7),pickfreq(8))
- %fprintf('Fail Freq: p1: %.1f%%, p2: %.1f%%, p3: %.1f%%, p4: %.1f%%\n',failfreq(1),failfreq(2),failfreq(3),failfreq(4))
- %fprintf('Fail Freq: p5: %.1f%%, p6: %.1f%%, p7: %.1f%%, p8: %.1f%%\n',failfreq(5),failfreq(6),failfreq(7),failfreq(8))
- fprintf('\nTotal sold value: %d, Avg sell value: %.2f, Avg Item value: %.2f\n',totalsell,avgsellval,totalsell/sold)
- %fprintf('Tesseract mean: %.2fms, max: %.2fms min: %.2fms\n',mean(tesstimes),max(tesstimes),min(tesstimes))
- fclose(logfile);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement