Author Topic: RTB Preference Menu - Prefs show but not the values  (Read 992 times)

I currently have a dilemma with my script. To allow more ease-of-use when changing preferences with my script, I have turned to the RTB Preference menu so that a new GUI would not have to be made. My problem is that all of my preferences show, but their values may not appear or the values may be incorrect.

My prefs.cs file is shown below. I just want to make sure I am properly implementing the RTB prefs system or if it is a bug due to the fact that I am trying to create too many preferences or something.
Code: [Select]
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
//This file allows you to change script settings.   +
//Settings can be changed within RTB.   +
//If the user does not have RTB, they can change settings below.  +
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

$PREF::NoProjectile = true; //This prevents resource exploits.
$PREF::NoPlayerProjectile = true; //This prevents resource exploits.

//++++++++++++++++++
//RTB Preferences  +
//++++++++++++++++++

if(isFile("Add-Ons/System_ReturnToBlockland/server.cs"))
{
if(!$RTB::RTBR_ServerControl_Hook)
exec("Add-Ons/System_ReturnToBlockland/RTBR_ServerControl_Hook.cs");

RTB_registerPref("Enable Alignment","Block City Settings","Pref::blockCity::enableAlignment", "list Off 0 On 1", "Script_BlockCity", 0, 0, 0);

RTB_registerPref("New User Block Amount","Block City Settings","$Pref::blockCity::newUserBlockAmount", "int 0 1000", "Script_BlockCity", 150, 0, 0);

    RTB_registerPref("Enable DM","Block City Settings","Pref::blockCity::enableDM", "list Off 0 On 1", "Script_BlockCity", 0, 0, 0);
RTB_registerPref("DM Win Reward","Block City Settings","Pref::blockCity::DMWinReward", "int 0 1000", "Script_BlockCity", 2, 0, 0);
RTB_registerPref("DM Loss Reward","Block City Settings","Pref::blockCity::DMLossReward", "int 0 1000", "Script_BlockCity", 1, 0, 0);

    RTB_registerPref("Enable VIP","Block City Settings","Pref::blockCity::enableVIP", "list Off 0 On 1", "Script_BlockCity", 0, 0, 0);
RTB_registerPref("VIP Price","Block City Settings","Pref::blockCity::vipPrice", "int 0 100000", "Script_BlockCity", 50000, 0, 0);

RTB_registerPref("16x16 Baseplate Price","Block City Settings","Pref::blockCity::16x16BaseplateCost", "int 0 1000", "Script_BlockCity", 25, 0, 0);
RTB_registerPref("32x32 Baseplate Price","Block City Settings","Pref::blockCity::32x32BaseplateCost", "int 0 2000", "Script_BlockCity", 100, 0, 0);
RTB_registerPref("48x48 Baseplate Price","Block City Settings","Pref::blockCity::48x48BaseplateCost", "int 0 3000", "Script_BlockCity", 200, 0, 0);
RTB_registerPref("64x64 Baseplate Price","Block City Settings","Pref::blockCity::64x64BaseplateCost", "int 0 4000", "Script_BlockCity", 400, 0, 0);

RTB_registerPref("Dirt Total Hits","Block City Settings","Pref::blockCity::dirtTotalHits", "int 0 100", "Script_BlockCity", 15, 0, 0);
RTB_registerPref("Dirt Block Reward","Block City Settings","Pref::blockCity::dirtBlockReward", "int 0 100", "Script_BlockCity", 2, 0, 0);
RTB_registerPref("Dirt Regeneration","Block City Settings","Pref::blockCity::dirtRegenerate", "int 0 300000", "Script_BlockCity", 120000, 0, 0);
RTB_registerPref("Dirt Cost","Block City Settings","Pref::blockCity::dirtCost", "int 0 1000", "Script_BlockCity", 300, 0, 0);

RTB_registerPref("Copper Total Hits","Block City Settings","Pref::blockCity::copperTotalHits", "int 0 100", "Script_BlockCity", 30, 0, 0);
RTB_registerPref("Copper Block Reward","Block City Settings","Pref::blockCity::copperBlockReward", "int 0 100", "Script_BlockCity", 5, 0, 0);
RTB_registerPref("Copper Regeneration","Block City Settings","Pref::blockCity::copperRegenerate", "int 0 300000", "Script_BlockCity", 120000, 0, 0);
RTB_registerPref("Copper Cost","Block City Settings","Pref::blockCity::copperCost", "int 0 2000", "Script_BlockCity", 750, 0, 0);

RTB_registerPref("Iron Total Hits","Block City Settings","Pref::blockCity::ironTotalHits", "int 0 200", "Script_BlockCity", 50, 0, 0);
RTB_registerPref("Iron Block Reward","Block City Settings","Pref::blockCity::ironBlockReward", "int 0 100", "Script_BlockCity", 10, 0, 0);
RTB_registerPref("Iron Regeneration","Block City Settings","Pref::blockCity::ironRegenerate", "int 0 300000", "Script_BlockCity", 120000, 0, 0);
RTB_registerPref("Iron Cost","Block City Settings","Pref::blockCity::ironCost", "int 0 3000", "Script_BlockCity", 1500, 0, 0);

RTB_registerPref("Silver Total Hits","Block City Settings","Pref::blockCity::silverTotalHits", "int 0 200", "Script_BlockCity", 65, 0, 0);
RTB_registerPref("Silver Block Reward","Block City Settings","Pref::blockCity::silverBlockReward", "int 0 100", "Script_BlockCity", 16, 0, 0);
RTB_registerPref("Silver Regeneration","Block City Settings","Pref::blockCity::silverRegenerate", "int 0 300000", "Script_BlockCity", 120000, 0, 0);
RTB_registerPref("Silver Cost","Block City Settings","Pref::blockCity::SilverCost", "int 0 4000", "Script_BlockCity", 2400, 0, 0);

RTB_registerPref("Gold Total Hits","Block City Settings","Pref::blockCity::goldTotalHits", "int 0 200", "Script_BlockCity", 75, 0, 0);
RTB_registerPref("Gold Block Reward","Block City Settings","Pref::blockCity::goldBlockReward", "int 0 100", "Script_BlockCity", 23, 0, 0);
RTB_registerPref("Gold Regeneration","Block City Settings","Pref::blockCity::goldRegenerate", "int 0 300000", "Script_BlockCity", 180000, 0, 0);
RTB_registerPref("Gold Cost","Block City Settings","Pref::blockCity::goldCost", "int 0 5000", "Script_BlockCity", 3450, 0, 0);

RTB_registerPref("Sapphire Total Hits","Block City Settings","Pref::blockCity::sapphireTotalHits", "int 0 200", "Script_BlockCity", 100, 0, 0);
RTB_registerPref("Sapphire Block Reward","Block City Settings","Pref::blockCity::sapphireBlockReward", "int 0 100", "Script_BlockCity", 35, 0, 0);
RTB_registerPref("Sapphire Regeneration","Block City Settings","Pref::blockCity::SapphireRegenerate", "int 0 300000", "Script_BlockCity", 300000, 0, 0);
RTB_registerPref("Sapphire Cost","Block City Settings","Pref::blockCity::sapphireCost", "int 0 6000", "Script_BlockCity", 8750, 0, 0);

RTB_registerPref("Emerald Total Hits","Block City Settings","Pref::blockCity::emeraldTotalHits", "int 0 200", "Script_BlockCity", 120, 0, 0);
RTB_registerPref("Emerald Block Reward","Block City Settings","Pref::blockCity::emeraldBlockReward", "int 0 100", "Script_BlockCity", 48, 0, 0);
RTB_registerPref("Emerald Regeneration","Block City Settings","Pref::blockCity::emeraldRegenerate", "int 0 300000", "Script_BlockCity", 300000, 0, 0);
RTB_registerPref("Emerald Cost","Block City Settings","Pref::blockCity::emeraldCost", "int 0 7000", "Script_BlockCity", 120000, 0, 0);

RTB_registerPref("Ruby Total Hits","Block City Settings","Pref::blockCity::rubyTotalHits", "int 0 3V:)V00", "Script_BlockCity", 150, 0, 0);
RTB_registerPref("Ruby Block Reward","Block City Settings","Pref::blockCity::rubyBlockReward", "int 0 200", "Script_BlockCity", 68, 0, 0);
RTB_registerPref("Ruby Regeneration","Block City Settings","Pref::blockCity::rubyRegenerate", "int 0 300000", "Script_BlockCity", 300000, 0, 0);
RTB_registerPref("Ruby Cost","Block City Settings","Pref::blockCity::rubyCost", "int 0 8000", "Script_BlockCity", 17000, 0, 0);

RTB_registerPref("Pine Total Hits","Block City Settings","Pref::blockCity::pineTotalHits", "int 0 100", "Script_BlockCity", 20, 0, 0);
RTB_registerPref("Pine Block Reward","Block City Settings","Pref::blockCity::pineBlockReward", "int 0 100", "Script_BlockCity", 6, 0, 0);
RTB_registerPref("Pine Regeneration","Block City Settings","Pref::blockCity::pineRegenerate", "int 0 300000", "Script_BlockCity", 180000, 0, 0);
RTB_registerPref("Pine Cost","Block City Settings","Pref::blockCity::pineCost", "int 0 2000", "Script_BlockCity", 1200, 0, 0);

RTB_registerPref("Birch Total Hits","Block City Settings","Pref::blockCity::birchTotalHits", "int 0 100", "Script_BlockCity", 40, 0, 0);
RTB_registerPref("Birch Block Reward","Block City Settings","Pref::blockCity::birchBlockReward", "int 0 100", "Script_BlockCity", 16, 0, 0);
RTB_registerPref("Birch Regeneration","Block City Settings","Pref::blockCity::birchRegenerate", "int 0 300000", "Script_BlockCity", 240000, 0, 0);
RTB_registerPref("Birch Cost","Block City Settings","Pref::blockCity::birchCost", "int 0 4000", "Script_BlockCity", 3200, 0, 0);

RTB_registerPref("Dead Tree Total Hits","Block City Settings","Pref::blockCity::deadTreeTotalHits", "int 0 100", "Script_BlockCity", 12, 0, 0);
RTB_registerPref("Dead Tree Block Reward","Block City Settings","Pref::blockCity::deadTreeBlockReward", "int 0 100", "Script_BlockCity", 3, 0, 0);
RTB_registerPref("Dead Tree Regeneration","Block City Settings","Pref::blockCity::deadTreeRegenerate", "int 0 300000", "Script_BlockCity", 120000, 0, 0);
RTB_registerPref("Dead Tree Cost","Block City Settings","Pref::blockCity::deadTreeCost", "int 0 2000", "Script_BlockCity", 600, 0, 0);

}
else
{

//+++++++++++++++++++++
//General Prefernces  +
//+++++++++++++++++++++

$Pref::blockCity::enableAlignment = false;

$Pref::blockCity::newUserBlockAmount = 150;

$Pref::blockCity::enableDM = false;
$Pref::blockCity::DMWinReward = 2;
$Pref::blockCity::DMLossReward = 1;

$Pref::blockCity::enableVIP = false;
$Pref::blockCity::vipPrice = 50000;

//+++++++++++++
//Lot Prices  +
//+++++++++++++

$Pref::blockCity::16x16BaseplateCost = 25;
$Pref::blockCity::32x32BaseplateCost = 100;
$Pref::blockCity::48x48BaseplateCost = 200;
$Pref::blockCity::64x64BaseplateCost = 400;

//+++++++++++++++++++++++
//Resource Preferences  +
//+++++++++++++++++++++++

//Dirt
$Pref::blockCity::dirtTotalHits = 15; //How many hits it takes.
$Pref::blockCity::dirtBlockReward = 2; //Amount of Blocks given.
$Pref::blockCity::dirtRegenerate = 120000; //Set in Milliseconds.
$Pref::blockCity::dirtCost = 300; //How much it costs to plant.

//Copper
$Pref::blockCity::copperTotalHits = 30; //How many hits it takes.
$Pref::blockCity::copperBlockReward = 5; //Amount of Blocks given.
$Pref::blockCity::copperRegenerate = 120000; //Set in Milliseconds.
$Pref::blockCity::copperCost = 750; //How much it costs to plant.

//Iron
$Pref::blockCity::ironTotalHits = 50; //How many hits it takes.
$Pref::blockCity::ironBlockReward = 10; //Amount of Blocks given.
$Pref::blockCity::ironRegenerate = 120000; //Set in Milliseconds.
$Pref::blockCity::ironCost = 1500; //How much it costs to plant.

//Silver
$Pref::blockCity::silverTotalHits = 65; //How many hits it takes.
$Pref::blockCity::silverBlockReward = 16; //Amount of Blocks given.
$Pref::blockCity::silverRegenerate = 120000; //Set in Milliseconds.
$Pref::blockCity::silverCost = 2400; //How much it costs to plant.

//Gold
$Pref::blockCity::goldTotalHits = 75; //How many hits it takes.
$Pref::blockCity::goldBlockReward = 23; //Amount of Blocks given.
$Pref::blockCity::goldRegenerate = 180000; //Set in Milliseconds.
$Pref::blockCity::goldCost = 3450; //How much it costs to plant.

//Sapphire
$Pref::blockCity::sapphireTotalHits = 100; //How many hits it takes.
$Pref::blockCity::sapphireBlockReward = 35; //Amount of Blocks given.
$Pref::blockCity::sapphireRegenerate = 300000; //Set in Milliseconds.
$Pref::blockCity::sapphireCost = 8750; //How much it costs to plant.

//Emerald
$Pref::blockCity::emeraldTotalHits = 120; //How many hits it takes.
$Pref::blockCity::emeraldBlockReward = 48; //Amount of Blocks given.
$Pref::blockCity::emeraldRegenerate = 300000; //Set in Milliseconds.
$Pref::blockCity::emeraldCost = 12000; //How much it costs to plant.

//Ruby
$Pref::blockCity::rubyTotalHits = 150; //How many hits it takes.
$Pref::blockCity::rubyBlockReward = 68; //Amount of Blocks given.
$Pref::blockCity::rubyRegenerate = 300000; //Set in Milliseconds.
$Pref::blockCity::rubyCost = 17000; //How much it costs to plant.

//Tree (Pine)
$Pref::blockCity::pineTotalHits = 20; //How many hits it takes.
$Pref::blockCity::pineBlockReward = 6; //Amount of Blocks given.
$Pref::blockCity::pineRegenerate = 180000; //Set in Milliseconds.
$Pref::blockCity::pineCost = 1200; //How much it costs to plant.

//Tree (Birch)
$Pref::blockCity::birchTotalHits = 40; //How many hits it takes.
$Pref::blockCity::birchBlockReward = 16; //Amount of Blocks given.
$Pref::blockCity::birchRegenerate = 240000; //Set in Milliseconds.
$Pref::blockCity::brichCost = 3200; //How much it costs to plant.

//Tree (Dead)
$Pref::blockCity::deadTreeTotalHits = 12; //How many hits it takes.
$Pref::blockCity::deadTreeBlockReward = 3; //Amount of Blocks given.
$Pref::blockCity::deadTreeRegenerate = 120000; //Set in Milliseconds.
$Pref::blockCity::deadTreeCost = 600; //How much it costs to plant.

}

I forgot to mention that Some preference values do, in fact, appear. It seems that at a certain point in a category they just stop appearing.

This could easily be an RTB problem, I'll check it out later.

What is with that } at the end?

Can you open Blockland, type trace(1); into the console, start a server (and make sure that some of the prefs are missing) then close the game and upload/post the log into this thread?

What is with that } at the end?

The } signifies the end of an else condition in an if statement. (in this particular instance)

Can you open Blockland, type trace(1); into the console, start a server (and make sure that some of the prefs are missing) then close the game and upload/post the log into this thread?

The } signifies the end of an else condition in an if statement. (in this particular instance)
Woops, didn't notice that there.

Here is the log file from a newly installed Blockland with only RTB any my script (Block City).

It can be found: Here.

I just setup a default v11 + RTB 2.03 install and tried registering those prefs and it worked fine for all of them.

I went to check to make sure that I haven't gone crazy or if some other part of my code is causing trouble so I took just the prefs.cs file that I have made (see original post for full code), removed my full script, and just executed my prefs.cs file within the Config folder. This is ran off of a vanilla Blockland Install and a newly-downloaded RTB.

Picture examples:
Executing the file from a dedicated server console:


These are the correct values and settings:


The values stop appearing here:

Oh. I expect that's because all the pref values are sent in one huge string and the limit is 255 characters per argument. I'll put it on the bug list for v3 but for now there isn't much you can do about it I'm afraid.