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
ReferenceError: identifier 'ui' undefined #113
Comments
He did say
so I'm betting that this will only show up in that context. No UI -> no |
This gets me to thinking... I may add documentation for server owners so they can change the configuration file by hand, since they might not have access to the UI. |
exactly :) The scripting Reference also has some info on this: Can I run code only if the user interface is available? Yes, it is good practice, particularly if writing scripts for servers to check if the game is running in headless mode before attempting to use any UI APIs. The ui namespace is not available in headless mode, so make sure you check it, otherwise an error will be thrown. if (typeof ui !== 'undefined') {
console.log("OpenRCT2 is not running in headless, UI is available!");
ui.registerMenuItem('My window', function() {
// ...
});
}
The UI is actually available to other players. Every client that connects can access the UI. Again from the Scripting Reference: Can servers add additional user interface elements to players? Yes, remote scripts are uploaded to every client and run as-is. Even if the server is running in headless mode, the script can still contain UI calls for the benefit of the players that are not running in headless mode. Be sure to check if the UI is available first before executing UI calls. kind regards :) PS: it just ocurred to me, that the plugin settings are maybe not shared between server and clients 🤔 I'll check later if changes from one Client also appear for other clients :) I also wonder, if every client will try to update the price ride settings individiually 🙈 |
Yeah, every client (with the plugin) will individually update the price every day, so the one who sets it last, wins. (Or that's probably how it works. Again, I'm too lazy to test 😜) Edit: and they absolutely do not sync settings |
yeah, I can confirm that they do not sync settings, this was easy enough to test. It wouldn't be too hard to disable the Plug In for clients in network games 🤔 Then the server would be the only one doing the daily price updates. In this case having some documentation about changing the configuration manually, like you suggested, would really be handy. Anyway, these things should probably better have their own issue, getting a little carried away here from the original topic ^^ |
https://github.com/mgovea/openrct2-ride-price-manager/releases/tag/v1.3.1 I did a lot of the bonus stuff we talked about. @kscheel would you mind double-checking the "set the server config" instructions in the readme? https://github.com/mgovea/openrct2-ride-price-manager/tree/v1.3.1#multiplayer Let me know if you have more ideas :) |
Really nice, thanks for the update! :) Unfortunately, the error still occurs. But I see you added a UI check for headless server homies ;D I noticed that your check And somehow the plug-in isn't working properly at all on my server. The daily price updates simply do not occur. But using "Force recalculate now" from a client works. Maybe the ReferenceError stops the plug-in execution on the server? Otherwise I could try to build the plug-in myself and add some debug output to the console to figure out what's going on. Regarding the readme instructions for multiplayer: I think it's only necessary to edit the configuration file when you're hosting a headless server? When I host game and also play on the host machine, I assume I could use the plug-in UI as usual? This could be clarified in the readme. And one more idea :) |
I bet the error prevents the daily calculation from registering.
Yeah, I want to have a UI library that is more dynamic, and I ran into a ton of trouble when trying to use https://github.com/oli414/OliUI Oooooh, I could disable the UI elements and have the state read from the server's config instead of from client config. Spicy, haha. |
Oh yeah, will do. Dunno why my eyes skipped over this part. |
I tried to do some reading, it seems
uuuh, that would be fancy 😋 cheers! |
damn u right See for yourself: if you hit F12 & open the browser console, you can test js stuff. I hope you know that I'm adding you to the list of authors. |
Looking good mate! We played for a few hours and everything seemed to work fine :) Squeezing all that sweet cash out of our guests 💸 Thanks for adding me as an author :3 |
Yee thanks |
Investigate & maybe fix.
Mentioned by @kscheel in #37 (comment)_
The text was updated successfully, but these errors were encountered: