Skip to content

Conversation

@Xoduz
Copy link
Collaborator

@Xoduz Xoduz commented Feb 7, 2026

  • [ADD] Added new JS Event that runs once for all scripts after shard has fully started up:
    • onScriptLoad()
  • [ADD] Added new JS Event that runs for all instances of scripts attached to objects after shard has fully started up:
    • onStart( myObj ) // myObj can be a Character, Item or TownRegion
  • [ADD] Added new JS Function to find nearest item with a specific section ID at a given location:
    • FindItemBySection( x, y, z, world, sectionId, [instanceId] )
  • [ADD] Added new Event Manager system that initializes on shard startup, which listens to event registrations from other scripts and schedules these events to be run once, a number of times with an interval, or recurring on specific day(s)/time of the week. See UOX3 documentation for full details. System can be enabled or disabled via a new setting in uox.ini:
    • EVENTMANAGERSYSTEM=0/1 // Defaults to enabled
  • [ADD] Added a global JS constant to detect in scripts whether UOX3 runs in debug mode:
    • UOX_DEBUG_MODE // Ex: if( UOX_DEBUG_MODE )
  • [FIX] Fixed an incorrectly named socket variable in js/item/potion.js

- [ADD] Added new JS Event that runs once for all scripts after shard has fully started up:
  - onScriptLoad()
- [ADD] Added new JS Event that runs for all instances of scripts attached to objects after shard has fully started up:
  - onStart( myObj ) // myObj can be a Character, Item or TownRegion
- [ADD] Added new JS Function to find nearest item with a specific section ID at a given location:
  - FindItemBySection( x, y, z, world, sectionId, [instanceId] )
- [ADD] Added new Event Manager system that initializes on shard startup, which listens to event registrations from other scripts and schedules these events to be run once, a number of times with an interval, or recurring on specific day(s)/time of the week. See UOX3 documentation for full details. System can be enabled or disabled via a new setting in uox.ini:
  - EVENTMANAGERSYSTEM=0/1 // Defaults to enabled
- [ADD] Added a global JS constant to detect in scripts whether UOX3 runs in debug mode:
  - UOX_DEBUG_MODE // Ex: if( UOX_DEBUG_MODE )
- [FIX] Fixed an incorrectly named socket variable in js/item/potion.js
Copy link
Contributor

@strattond strattond left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Mostly all good. Probably needs a sync up, one obvious bug (a function that doesn't exist). The rest is largely cosmetic stuff.

- [UPD] Updated FindItem() and FindItemBySection() JS Functions to also find items that are within +/- 5 Z of target location; Z no longer acts as an absolute condition
Added back in the dictionary entries for Dawn's Music Box, which somehow got lost in the first submission
Moved several Event Manager object properties from script to DFN
Added in typedef comments for functions in event manager script
Added in missing code to properly trigger onScriptLoad after script reloads
@Xoduz Xoduz requested a review from strattond February 12, 2026 06:43
@strattond strattond force-pushed the event_manager_system_20260207 branch from a0adda5 to dc6d610 Compare February 12, 2026 06:46
curEvent.enabled = newState;

// Reschedule event to next valid window if it missed previous cycle
if( newState === true && event.nextRun < new Date().getTime() )
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you mean curEvent here? event doesn't exist?

if( !curEvent.isRunning )
{
socket.SysMessage( GetDictionaryEntry( 6520, socket.language )); // Event reenabled and rescheduled for next valid activation window.
CalculateNextRun( event );
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Likewise here - event vs curEvent

if( index >= 0 && index < gEventList.length )
{
let curEvent = gEventList[index];
if( event.isRunning )
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And here - do you mean curEvent?

{
let mFile = new UOXCFile();

if( mFile.Open( eventDataFile, "w", eventDataFolder ))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So, this isn't going to do what you want - have a look at CFile_Open in the C++ code.

It doesn't return a value at all, it's a void return.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants