Guest User

Touhou Henkaden V1.2 Replay Screen Context Fix

a guest
Dec 20th, 2015
288
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. ++ Initial error output
  2.  
  3. //////////////////////////////////////////////////////////////////////////////////////////////////////////////////
  4. Variables of different types are being compared
  5. (型が違う値同士を比較しようとしました)
  6. Z:/home/nassim/Documents/game/danmakufu/PancakeGame/Touhou Henkaden ~ Highly Responsive to Pancakes/script/Highly Responsive to Pancakes/Package.dnh
  7. Package.dnh line(行)=920
  8.  
  9. ↓
  10.         if(info[0] == "StagePackMode"){SetCommonData("StagePackPath", info[2]);}
  11.        
  12.         TStageScene(GetReplayInfo(result, REPLAY_FILE_PATH));
  13.     }
  14. }
  15.  
  16. task TStagePackSelectScene {
  17.     SetSkipModeKey(KEY_INVALID);
  18.  
  19.     let idScript = LoadScript(GetCurrentScriptDir
  20. ~~~
  21. /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
  22.  
  23. ++ Fix
  24.  
  25. /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
  26. // File: Package.dnh
  27. //
  28. // starts line 904
  29. /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
  30.  
  31. task TReplaySelectScene {
  32.     SetSkipModeKey(KEY_INVALID);
  33.  
  34.     let idScript = LoadScript(GetCurrentScriptDirectory ~ "System/ReplaySelectScene.dnh");
  35.     StartScript(idScript);
  36.    
  37.     while(!IsCloseScript(idScript)) {
  38.         yield;
  39.     }
  40.    
  41.     let result = GetScriptResult(idScript);
  42.     if(result == -1) {
  43.         TTitleScene;
  44.     } else {
  45.        
  46.         let info = GetReplayInfo(result, REPLAY_COMMENT);
  47.         let len = length(info);
  48.         WriteLog("GETREPLAYINFO =========== length " ~ vtos("1d", len) ~ " == info " ~ ToString(info));
  49.  
  50.         // GetReplayInfo(result, RELAY_COMMENT) does not return an array but a string
  51.         // I have not test if it's SetReplayInfo which converts the array to a string
  52.         info = serializedArrayToArray(info);
  53.         len = length(info);
  54.         WriteLog("GETREPLAYINFO =========== length " ~ vtos("1d", len) ~ " == info " ~ ToString(info));
  55.  
  56.         //RaiseError("muujah!");
  57.  
  58.  
  59.         SetCommonData("PLAYER", info[0]);
  60.         SetCommonData("Mode", info[1]);
  61.         //if(info[0] == "StagePackMode"){SetCommonData("StagePackPath", info[2]);}
  62.         if(isSameString("StagePackMode", info[1])){SetCommonData("StagePackPath", info[2]);}
  63.        
  64.         TStageScene(GetReplayInfo(result, REPLAY_FILE_PATH));
  65.     }
  66. }
  67.  
  68. /* =========================================================================
  69. isSameString
  70.  
  71. Checks if the two input strings are identical
  72.  
  73. @param   string    ref      reference string
  74. @param   string    string   string to test
  75.  
  76. @return  boolean   true if strings are identical, false otherwise
  77. ========================================================================= */
  78. function isSameString(let ref, let string) {
  79.     if(length(string) != length(ref)) { return false; }
  80.     ascent(i in 0..length(ref)) {
  81.         if(string[i]!=ref[i]) { return false; }
  82.     }
  83.     return true;
  84. }
  85.  
  86. /* =========================================================================
  87. serializedArrayToArray
  88.  
  89. Converts a serialized array (string value) to a regular array
  90.  
  91. @param    string    stringArray    the serialized array to convert
  92.  
  93. @return   array
  94. ========================================================================= */
  95. function serializedArrayToArray(let stringArray) {
  96.     let separator = ",";
  97.     let len = length(stringArray);
  98.     //let separatorCount = 0;
  99.     let results = [];
  100.     let temp = "";
  101.     // range is 1..len-1 in order to get rid of "[" and "]" characters
  102.     ascent(i in 1..len-1) {
  103.         if(ToString(stringArray[i])!=separator) {
  104.             temp = temp ~ ToString(stringArray[i]);
  105.         }
  106.         else {
  107.             results = results ~ [ temp ];
  108.             temp = "";
  109.         }
  110.     }
  111.     // last result
  112.     results = results ~ [ temp ];
  113.  
  114.     return results;
  115. }
Advertisement
Add Comment
Please, Sign In to add comment