Giter VIP home page Giter VIP logo

Comments (14)

mgovea avatar mgovea commented on May 12, 2024 1

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 :)

from openrct2-ride-price-manager.

mgovea avatar mgovea commented on May 12, 2024 1

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.

Oh yeah, will do. Dunno why my eyes skipped over this part.

from openrct2-ride-price-manager.

mgovea avatar mgovea commented on May 12, 2024 1

if (ui) throws the reference error

damn u right

See for yourself: if you hit F12 & open the browser console, you can test js stuff. !!undefined returns false, while !!a throws.

I hope you know that I'm adding you to the list of authors.

from openrct2-ride-price-manager.

mgovea avatar mgovea commented on May 12, 2024 1

@kscheel LG?
https://github.com/mgovea/openrct2-ride-price-manager/releases/tag/v1.3.2
https://github.com/mgovea/openrct2-ride-price-manager/tree/v1.3.2#multiplayer

from openrct2-ride-price-manager.

mgovea avatar mgovea commented on May 12, 2024

He did say

it throws an error on my headless server

so I'm betting that this will only show up in that context. No UI -> no ui

from openrct2-ride-price-manager.

mgovea avatar mgovea commented on May 12, 2024

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.

from openrct2-ride-price-manager.

KuestenKeks avatar KuestenKeks commented on May 12, 2024

so I'm betting that this will only show up in that context. No UI -> no 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() {
        // ...
    });
}

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.

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 🙈

from openrct2-ride-price-manager.

mgovea avatar mgovea commented on May 12, 2024

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

from openrct2-ride-price-manager.

KuestenKeks avatar KuestenKeks commented on May 12, 2024

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 ^^

from openrct2-ride-price-manager.

KuestenKeks avatar KuestenKeks commented on May 12, 2024

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 if (ui) doesn't use typeof like the the example does. Maybe it should be if (typeof ui !== 'undefined')? But idk if that's correct typescript syntax, as the official example doesn't use typescript ;)

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 :)
Maybe the UI elements a client can't use could be disabled for clients? Then only the two buttons "Force recalculate now" and "Make rides free" would be enabled. (And as an optional bonus an info text box for this situation could be added, e.g.: "Plug-In Settings are managed by the host" ;)

from openrct2-ride-price-manager.

mgovea avatar mgovea commented on May 12, 2024

I bet the error prevents the daily calculation from registering.

if (ui) is a "truthy" check, and undefined should always be "falsey". So I'll do what the man says, but I don't know why it wouldn't work the way I wrote it.

Maybe the UI elements a client can't use could be disabled for clients?

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
I want to make a React-based UI library, but that is more work than I was willing to do last time I looked into it. But having a different UI for MP clients would be nice. I also kinda want to have admins (players with the kick_player permission) have their config changes sync to the server, but that seems like a lot, haha.

Oooooh, I could disable the UI elements and have the state read from the server's config instead of from client config. Spicy, haha.

from openrct2-ride-price-manager.

KuestenKeks avatar KuestenKeks commented on May 12, 2024

if (ui) is a "truthy" check, and undefined should always be "falsey". So I'll do what the man says, but I don't know why it wouldn't work the way I wrote it.

I tried to do some reading, it seems if (ui) throws the reference error because ui isn't just undefined, it was never declared. Therefore trying to access ui just throws the ReferenceError exception instead of evaluating to true or false 🤔 But using typeof is safe :)

Oooooh, I could disable the UI elements and have the state read from the server's config instead of from client config. Spicy, haha.

uuuh, that would be fancy 😋
And yeah, having the UI of admin clients fully functional / syncing with the server would also be fancy, but I'm happy with editing the config file for now :)

cheers!

from openrct2-ride-price-manager.

KuestenKeks avatar KuestenKeks commented on May 12, 2024

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

from openrct2-ride-price-manager.

mgovea avatar mgovea commented on May 12, 2024

Yee thanks

from openrct2-ride-price-manager.

Related Issues (10)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.