Author Topic: Values missing from RTB prefs?  (Read 1345 times)

I recently set up a dedicated server and I can't change some values in RTB prefs. i get the feeling that this is because i'm not host. how do i fix this?

The RTB preffs don't always show every preff if you're talking about the ones other add-ons create, if you're talking about the standard server ones then you have a legit error.

The RTB preffs don't always show every preff if you're talking about the ones other add-ons create, if you're talking about the standard server ones then you have a legit error.
I'm talking about the RTB prefs for my addons, like T+T ammo etc.

Well the way RTB preffs were coded this isn't a legit issue, for some reason or another there is a set limit on how many will show up on he list. I have yet to figure out the actual cause of this, but as soon as I can I'll be sure to put something out that'll help fix it.

Well the way RTB preffs were coded this isn't a legit issue, for some reason or another there is a set limit on how many will show up on he list. I have yet to figure out the actual cause of this, but as soon as I can I'll be sure to put something out that'll help fix it.
they showed p just fine when i wasn't hosting dedi.

i'm having the exact same issue with my dedicated server, and even when i make myself host through the console all the prefs still don't show up. one solution that i've found is going into the addon and looking for the pref you want to change and then change it through the console, but as one can imagine it takes ages to get all the right prefs set up.

I tried using GRTB because someone said that would work, and it doesn't work.

Well the way RTB preffs were coded this isn't a legit issue, for some reason or another there is a set limit on how many will show up on he list. I have yet to figure out the actual cause of this, but as soon as I can I'll be sure to put something out that'll help fix it.
I found the cause ages ago but it seems like noone cares about it. The problem is that badly written add-ons execute servercontrol.cs again without first checking if it was loaded, resetting the counter and basically deleting all previously created prefs. The fix is as simple as placing something like this at the top:

//Check if module has already been loaded
if($RTB::Hooks::ServerControl == 1)
{
   error("    Why are you randomly executing this file?");
   return;
}

I found the cause ages ago but it seems like noone cares about it. The problem is that badly written add-ons execute servercontrol.cs again without first checking if it was loaded, resetting the counter and basically deleting all previously created prefs. The fix is as simple as placing something like this at the top:

//Check if module has already been loaded
if($RTB::Hooks::ServerControl == 1)
{
   error("    Why are you randomly executing this file?");
   return;
}

so i have to do this for all the prefs, or just the preference at the top of the preference list?

so i have to do this for all the prefs, or just the preference at the top of the preference list?
go to the folder hooks/serverControl.cs inside the rtb system folder and place the line of code at the very top. it worked for me

I found the cause ages ago but it seems like noone cares about it. The problem is that badly written add-ons execute servercontrol.cs again without first checking if it was loaded, resetting the counter and basically deleting all previously created prefs. The fix is as simple as placing something like this at the top:

//Check if module has already been loaded
if($RTB::Hooks::ServerControl == 1)
{
   error("    Why are you randomly executing this file?");
   return;
}

It's also because older add-ons don't use the right hooks path or check for the correct global variable.

I tried using GRTB because someone said that would work, and it doesn't work.
GRTB increases the limit for GUI control objects, in theory it allows you to have more server prefs on the server control list; That is, providing they use the correct hooks variable and path!

------------------------------

How to fix this issue:

For every add-on that's prefs are not showing up, you need to change the hooks global var and path in the main code (or whichever cs file has the server prefs code). Here is an example (fixed duplicator prefs)

Quote from: TorqueScript
if($RTB::Hooks:ServerControl)
exec("Add-Ons/System_ReturnToBlockland/hooks/serverControl.cs");

RTB_registerPref("Admin Only", "Duplorcator", "Pref::Duplorcator::AdminOnly", "bool", "Tool_Duplicator", 0, 0, 0);

Hope this helps. Good luck!

That's going to check if it IS executed (by the preference) and execute it again.
Breaking the preference system.
I found the cause ages ago but it seems like noone cares about it. The problem is that badly written add-ons execute servercontrol.cs again without first checking if it was loaded, resetting the counter and basically deleting all previously created prefs. The fix is as simple as placing something like this at the top:

//Check if module has already been loaded
if($RTB::Hooks::ServerControl == 1)
{
   error("    Why are you randomly executing this file?");
   return;
}

What Zeblote says right here should fix it, just add that to the top of the serverControl.cs file.
Why doesn't RTB do this by default. It seems pretty stupid to me.

Why doesn't RTB do this by default. It seems pretty stupid to me.
I guess he just thought that mod authors won't randomly execute the file again for no reason.

It's also because older add-ons don't use the right hooks path or check for the correct global variable.
GRTB increases the limit for GUI control objects, in theory it allows you to have more server prefs on the server control list; That is, providing they use the correct hooks variable and path!

------------------------------

How to fix this issue:

For every add-on that's prefs are not showing up, you need to change the hooks global var and path in the main code (or whichever cs file has the server prefs code). Here is an example (fixed duplicator prefs)

Hope this helps. Good luck!
Test your stuff before you reply. I've already posted the exact issue and a solution.