Advertisement
Appendko

X5評價迴圈Script

Nov 26th, 2015
422
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 2.48 KB | None | 0 0
  1. pcsx.speedmode("maximum")
  2. local file = io.open("tmp.csv","w")
  3. file:write("Rank, Rank2, Time, Damage, Kills, Output, Virus\n")
  4.  
  5. --測試用
  6. --t={0x0E0F, 0x1C1F, 0x2A2F, 0x383F, 0x464F, 0x545F, 0x626F, 0x707F, 0x7E8F, 0x8C9F}
  7. --tn={"0m59s98","1m59s98","2m59s98","3m59s98",
  8. --    "4m59s98","5m59s98","6m59s98","7m59s98",
  9. --    "8m59s98","9m59s98"} --"ticktime[1]~[10]
  10.  
  11. r={"MEH","PA","GA","SA","A","B","C","E"} --rank[1]~[8]
  12. t={0x0E0F, 0x1C1F, 0x464F, 0x545F}
  13. tn={"0m59s98","1m59s98","4m59s98","5m59s98"} --"ticktime[1]~[4]
  14. --$0E0F 0:59:98 $1C1F 1:59:98 $464F 4:59:98 $545F 5:59:98
  15. d={15, 31, 63, 64} --damage[1]~[4]
  16. k={39, 79, 149, 150} --kills[1]~[4]
  17. o={8,6,4,3} --output[1]~[4]
  18. v={0,1,2,3} --virus[1]~[4]
  19. sc={8,4,2,1} --sc[1]~[4]
  20.  
  21. tmp=savestate.create()
  22. savestate.save(tmp)
  23. ir2=7;
  24.  
  25. for ir = 1,8 do
  26. for it = 1,4 do
  27. for id = 1,4 do
  28. for ik = 1,4 do
  29. for io = 1,4 do
  30. for iv = 1,4 do
  31.     savestate.load(tmp)
  32.     tick=pcsx.framecount()
  33.     memory.writebyte(0x0D3182,ir-1);--獵人等級 0D3182(X) 0D3183(Z)
  34.     memory.writeword(0x0D3188,t[it]);--破關時間
  35.     memory.writebyte(0x0D3190,d[id]);--受傷
  36.     memory.writebyte(0x0D318C,k[ik]);--殺敵數
  37.     memory.writebyte(0x0D3194,o[io]);--最大輸出
  38.     memory.writebyte(0x0D3196,v[iv])--病毒
  39.     while (pcsx.framecount()-tick)<(5) do      
  40.         pcsx.frameadvance()
  41.     end
  42.     ir2=memory.readbyte(0x0D3182)+1;--獵人等級 0D3182(X) 0D3183(Z)
  43.     score=sc[it]+sc[id]+sc[ik]+sc[io]+sc[iv]
  44.     --計算評價
  45.     if  ir==1 then --MEH
  46.         if  score>=32 then  ir3=1
  47.         else            ir3=2
  48.         end
  49.     elseif  ir==2 then --PA
  50.         if  score==40 then  ir3=1
  51.         elseif  score>=32 then  ir3=2
  52.         else            ir3=3
  53.         end
  54.     elseif  ir==3 then --GA
  55.         if  score>=36 then  ir3=2
  56.         elseif  score>=24 then  ir3=3
  57.         else            ir3=4
  58.         end
  59.     elseif  ir==4 then --SA
  60.         if  score>=32 then  ir3=3
  61.         elseif  score>=20 then  ir3=4
  62.         else            ir3=5
  63.         end
  64.     elseif  ir==5 then --A
  65.         if  score>=32 then  ir3=4
  66.         elseif  score>=18 then  ir3=5
  67.         else            ir3=6
  68.         end
  69.     elseif  ir==6 then --B
  70.         if  score>=28 then  ir3=5
  71.         elseif  score>=15 then  ir3=6
  72.         else            ir3=7
  73.         end
  74.     elseif  ir==7 then --C
  75.         if  score>=20 then  ir3=6
  76.         elseif  score>=12 then  ir3=7
  77.         else            ir3=8
  78.         end
  79.     elseif  ir==8 then --E
  80.         if  score>=16 then  ir3=7
  81.         else            ir3=8      
  82.         end
  83.     end
  84.     if ir2==ir3 then    res="TRUE"
  85.     else            res="FALSE"
  86.     end
  87.     str=r[ir]..","..r[ir2]..","..tn[it]..","..d[id]..","..k[ik]..","..o[io]..","..v[iv]..","..score..","..r[ir3]..","..res.."\n"
  88.     file:write(str)    
  89. end
  90. end
  91. end
  92. end
  93. end
  94. end
  95. file:close()
  96. pcsx.speedmode("turbo")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement