-
Notifications
You must be signed in to change notification settings - Fork 29
Event Manager, onScriptLoad, onStart, FindItemBySection #500
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: develop
Are you sure you want to change the base?
Conversation
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
strattond
left a comment
There was a problem hiding this 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
a0adda5 to
dc6d610
Compare
| curEvent.enabled = newState; | ||
|
|
||
| // Reschedule event to next valid window if it missed previous cycle | ||
| if( newState === true && event.nextRun < new Date().getTime() ) |
There was a problem hiding this comment.
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 ); |
There was a problem hiding this comment.
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 ) |
There was a problem hiding this comment.
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 )) |
There was a problem hiding this comment.
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.