5.0 KiB
Game start
In private void e(string A_0)
in 2.6
- 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
- needed:
g
: fixup object and character locations inside rooms (replace with UUID if it is a name)CorrectCommandsAndConditions
: Add missing exits, buggily add missing<<On Character Enter>>
and<<On Character Leave>>
actions to characters, fixup actions, fixup object inside object locations (likeg
).s
,r
: Status bar?- Hide main pic, portrait when needed
- Prompt for gender if needed (window title:
Select Player Gender
, prompt:Enter Your Gender:
) - Prompt for name if needed (prompt:
Enter your character's name:
). If empty: MsgBoxSorry, you can not enter an empty player name.
, retry. - Print to log: Title, Opening Message
- Get starting room
m
: inventory shitl
: room object shit, portala(image, true/false)
: image shita(true, true)
: room enter procedure with actions and timers.m
,l
againh
: characters in roomd
: execute<<On Game Start>>
(then 150 lines of completely unnecessary code executed)- Start bg music
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 toss
, 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. PlusDISPLAYCHARDESC
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
- If the action is not
Active
, it doesn't do anything. - Increase
TurnNumber
- If
TurnNumber > Length
and this is a with length timer: setTurnNumber
to 0, and if not auto restart setActive
to false. - Otherwise execute these actions in order:
"<<On Each Turn>>"
,"<<On Turn " + TurnNumber + ">>"
, and ifTurnNumber == Length
:"<<On Last Turn>>"
. If any action resets the timer, subsequent actions are skipped. - Update the status bar.
- 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
- Iterate through all timer:
- Set the currently executing timer
- If it is not a live timer, execute single timer procedure until it returns true.
- Refresh actions, inventory, room objects, character lists
- 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 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
- Write the moce direction to the log (
North
,SouthWest
, etc.) - Execute room enter's inner procedure, but
with
Leave
instead ofEnter
, with<<On Player Leave First Time>>
whenLeaveFirstTime
is false, then with<<On Player Enter>>
. - If the move was canceled, don't do anything else.
- Move the player to the specified room.
- Execute room enter procedure with actions and timers.