You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
106 lines
5.0 KiB
Markdown
106 lines
5.0 KiB
Markdown
# Game start
|
|
In `private void e(string A_0)` in 2.6
|
|
|
|
1. Sort characters, then objects when needed
|
|
* needed: `sort_order == ALPHA`, the other two orders enum val doesn't do
|
|
anything
|
|
* inventory and room object order sort the same list, so as long at least
|
|
one of them is `ALPHA`, they will be sorted...
|
|
* apparently they are not resorted after a name change
|
|
2. `g`: fixup object and character locations inside rooms (replace with UUID if
|
|
it is a name)
|
|
3. `CorrectCommandsAndConditions`: Add missing exits, buggily add missing `<<On
|
|
Character Enter>>` and `<<On Character Leave>>` actions to characters, fixup
|
|
actions, fixup object inside object locations (like `g`).
|
|
4. `s`, `r`: Status bar?
|
|
5. Hide main pic, portrait when needed
|
|
6. Prompt for gender if needed (window title: `Select Player Gender`, prompt:
|
|
`Enter Your Gender:`)
|
|
7. Prompt for name if needed (prompt: `Enter your character's name:`). If empty:
|
|
MsgBox `Sorry, you can not enter an empty player name.`, retry.
|
|
8. Print to log: Title, Opening Message
|
|
9. Get starting room
|
|
10. `m`: inventory shit
|
|
11. `l`: room object shit, portal
|
|
12. `a(image, true/false)`: image shit
|
|
13. `a(true, true)`: [room enter procedure](actions.md#room-enter-procedure)
|
|
with actions and timers.
|
|
14. `m`, `l` again
|
|
15. `h`: characters in room
|
|
16. `d`: execute `<<On Game Start>>` (then 150 lines of completely
|
|
unnecessary code executed)
|
|
17. Start bg music
|
|
18. `o`: actions for player & room
|
|
|
|
# Random notes
|
|
* Names are generally case insensitive. Due to .NET this means Unicode and the
|
|
whole kitchen sink, like `ß` being equal to `ss`, and other nonsense like
|
|
`👭` == `👫` (at least under mono, fortunately my win7 vm doesn't seem to
|
|
support this emoji cancer).
|
|
* `HideMainPic && UseInlineImages`: images pasted into the log text (?)
|
|
* Action names starting with `<<` are hidden
|
|
* Turn off notifications: do not print `You can see ...`, `... is here` lines.
|
|
Plus `DISPLAYCHARDESC` action: do not print wearing, carrying
|
|
|
|
# Player
|
|
* There's only one of it
|
|
* On start it's always in a room (you can't set it to none in the designer, and
|
|
if you delete his starting room -> crash on load)
|
|
|
|
# Portal items
|
|
* Visible in room object list if room's any exit has this as portal
|
|
* Their location is set to `LT_PORTAL`, but it is only checked when printing the
|
|
contents of the object (they're somewhy skipped for portals), but actions can
|
|
overwrite this location while still remaining a portal, so this whole location
|
|
type is kinda useless (other than being an another source of bugs).
|
|
|
|
# Timers
|
|
## Single timer execute {#timer-single}
|
|
0. If the action is not `Active`, it doesn't do anything.
|
|
1. Increase `TurnNumber`
|
|
2. If `TurnNumber > Length` and this is a with length timer: set `TurnNumber` to
|
|
0, and if not auto restart set `Active` to false.
|
|
3. Otherwise execute these actions in order: `"<<On Each Turn>>"`, `"<<On Turn
|
|
" + TurnNumber + ">>"`, and if `TurnNumber == Length`: `"<<On Last Turn>>"`.
|
|
If any action resets the timer, subsequent actions are skipped.
|
|
4. Update the status bar.
|
|
5. Returns false if during each turn/n turn action the timer was reset (but not
|
|
if during the last).
|
|
|
|
Note that this means with auto restart events, executing actions are skipped in
|
|
one round (when `TurnNumber == Length+1`).
|
|
|
|
## Multi timer execute {#timer-multi}
|
|
0. Iterate through all timer:
|
|
0. Set the currently executing timer
|
|
1. If it is not a live timer, execute [single timer procedure](#timer-single)
|
|
until it returns true.
|
|
1. Refresh actions, inventory, room objects, character lists
|
|
2. Clear the currently executing timer, even in case of an exception
|
|
|
|
This is called from: game startup, when changing rooms from the UI, after
|
|
loading a savegame (?), after executing an action (if it didn't end the game).
|
|
|
|
## Live timers
|
|
There is a background thread (`RunTestThread`) for EVERY FUCKING LIVE TIMER
|
|
(even inactive ones). It sleeps for 500ms then it increases the elapsed time
|
|
variable by 500ms. If `elapsed_time >= TimerSeconds`, it sets elapsed time back
|
|
to 0 and if the timer is active, it post a message back to the GUI thread to
|
|
execute the [single timer procedure](#timer-single) then blocks until it
|
|
finishes. If it somehow manages to raise an exception, the thread quits. Yes,
|
|
this means this is completely unsuitable for timers more than a few seconds,
|
|
since for example if you have timer for 60s, activating it means it will trigger
|
|
any time between the next 20ns and 2 hours.
|
|
|
|
# Move to an other room
|
|
When the user manually selects a move direction in the GUI:
|
|
0. Increase `TurnNumber`
|
|
1. Write the moce direction to the log (`North`, `SouthWest`, etc.)
|
|
2. Execute [room enter](actions.md#room-enter-procedure)'s inner procedure, but
|
|
with `Leave` instead of `Enter`, with `<<On Player Leave First Time>>` when
|
|
`LeaveFirstTime` is false, then with `<<On Player Enter>>`.
|
|
3. If the move was canceled, don't do anything else.
|
|
4. Move the player to the specified room.
|
|
5. Execute [room enter procedure](actions.md#room-enter-procedure) with actions
|
|
and timers.
|