general.md (5095B)
1 # Game start 2 In `private void e(string A_0)` in 2.6 3 4 1. Sort characters, then objects when needed 5 * needed: `sort_order == ALPHA`, the other two orders enum val doesn't do 6 anything 7 * inventory and room object order sort the same list, so as long at least 8 one of them is `ALPHA`, they will be sorted... 9 * apparently they are not resorted after a name change 10 2. `g`: fixup object and character locations inside rooms (replace with UUID if 11 it is a name) 12 3. `CorrectCommandsAndConditions`: Add missing exits, buggily add missing `<<On 13 Character Enter>>` and `<<On Character Leave>>` actions to characters, fixup 14 actions, fixup object inside object locations (like `g`). 15 4. `s`, `r`: Status bar? 16 5. Hide main pic, portrait when needed 17 6. Prompt for gender if needed (window title: `Select Player Gender`, prompt: 18 `Enter Your Gender:`) 19 7. Prompt for name if needed (prompt: `Enter your character's name:`). If empty: 20 MsgBox `Sorry, you can not enter an empty player name.`, retry. 21 8. Print to log: Title, Opening Message 22 9. Get starting room 23 10. `m`: inventory shit 24 11. `l`: room object shit, portal 25 12. `a(image, true/false)`: image shit 26 13. `a(true, true)`: [room enter procedure](actions.md#room-enter-procedure) 27 with actions and timers. 28 14. `m`, `l` again 29 15. `h`: characters in room 30 16. `d`: execute `<<On Game Start>>` (then 150 lines of completely 31 unnecessary code executed) 32 17. Start bg music 33 18. `o`: actions for player & room 34 35 # Random notes 36 * Names are generally case insensitive. Due to .NET this means Unicode and the 37 whole kitchen sink, like `ß` being equal to `ss`, and other nonsense like 38 `👭` == `👫` (at least under mono, fortunately my win7 vm doesn't seem to 39 support this emoji cancer). 40 * `HideMainPic && UseInlineImages`: images pasted into the log text (?) 41 * Action names starting with `<<` are hidden 42 * Turn off notifications: do not print `You can see ...`, `... is here` lines. 43 Plus `DISPLAYCHARDESC` action: do not print wearing, carrying 44 45 # Player 46 * There's only one of it 47 * On start it's always in a room (you can't set it to none in the designer, and 48 if you delete his starting room -> crash on load) 49 50 # Portal items 51 * Visible in room object list if room's any exit has this as portal 52 * Their location is set to `LT_PORTAL`, but it is only checked when printing the 53 contents of the object (they're somewhy skipped for portals), but actions can 54 overwrite this location while still remaining a portal, so this whole location 55 type is kinda useless (other than being an another source of bugs). 56 57 # Timers 58 ## Single timer execute {#timer-single} 59 0. If the action is not `Active`, it doesn't do anything. 60 1. Increase `TurnNumber` 61 2. If `TurnNumber > Length` and this is a with length timer: set `TurnNumber` to 62 0, and if not auto restart set `Active` to false. 63 3. Otherwise execute these actions in order: `"<<On Each Turn>>"`, `"<<On Turn 64 " + TurnNumber + ">>"`, and if `TurnNumber == Length`: `"<<On Last Turn>>"`. 65 If any action resets the timer, subsequent actions are skipped. 66 4. Update the status bar. 67 5. Returns false if during each turn/n turn action the timer was reset (but not 68 if during the last). 69 70 Note that this means with auto restart events, executing actions are skipped in 71 one round (when `TurnNumber == Length+1`). 72 73 ## Multi timer execute {#timer-multi} 74 0. Iterate through all timer: 75 0. Set the currently executing timer 76 1. If it is not a live timer, execute [single timer procedure](#timer-single) 77 until it returns true. 78 1. Refresh actions, inventory, room objects, character lists 79 2. Clear the currently executing timer, even in case of an exception 80 81 This is called from: game startup, when changing rooms from the UI, after 82 loading a savegame (?), after executing an action (if it didn't end the game). 83 84 ## Live timers 85 There is a background thread (`RunTestThread`) for EVERY FUCKING LIVE TIMER 86 (even inactive ones). It sleeps for 500ms then it increases the elapsed time 87 variable by 500ms. If `elapsed_time >= TimerSeconds`, it sets elapsed time back 88 to 0 and if the timer is active, it post a message back to the GUI thread to 89 execute the [single timer procedure](#timer-single) then blocks until it 90 finishes. If it somehow manages to raise an exception, the thread quits. Yes, 91 this means this is completely unsuitable for timers more than a few seconds, 92 since for example if you have timer for 60s, activating it means it will trigger 93 any time between the next 20ns and 2 hours. 94 95 # Move to an other room 96 When the user manually selects a move direction in the GUI: 97 0. Increase `TurnNumber` 98 1. Write the moce direction to the log (`North`, `SouthWest`, etc.) 99 2. Execute [room enter](actions.md#room-enter-procedure)'s inner procedure, but 100 with `Leave` instead of `Enter`, with `<<On Player Leave First Time>>` when 101 `LeaveFirstTime` is false, then with `<<On Player Enter>>`. 102 3. If the move was canceled, don't do anything else. 103 4. Move the player to the specified room. 104 5. Execute [room enter procedure](actions.md#room-enter-procedure) with actions 105 and timers.