creating a new Scroll Control Profile

Author Topic: creating a new Scroll Control Profile  (Read 1581 times)

i need to know how to create a new scroll profile, basicly just the code i get that you have to make the  blockScroll edit, Thanks

blockScrollProfile.save("config/temp.cs");

i dont get where to use this, could you post the full code such as
Code: [Select]
new GuiControlProfile(PipBoyWindowProfile : GuiWindowProfile)
{
opaque = 1;

hasBitmapArray = 1;
bitmap = "./Images/blockWindow1";

fillColor = "14 14 14 255";
fillColorHL = "14 14 14 255";
fillColorNA = "14 14 14 255";

fontColor = "67 162 14 255";
fontColorHL = "67 162 14 255";
fontColorNA = "67 162 14 255";
fontColorSEL = "67 162 14 255";
fontColorLink = "67 162 14 255";
fontColorLinkHL = "67 162 14 255";

fontType = "Impact";
fontSize = 18;
textOffset = "10 5";
justify = "left";

modal = true;
};
and yes i know this is for a window profile

You put that line in your console and then look at config/temp.cs

i hit another problem im trying to send my local variables to my GUI for a inventory system, but its not working
Server.cs
Code: [Select]
function serverCmdLight(%client, %brick)
{
%player = %client.player;

commandToClient(%client, 'InfoSend', %client.backPack["Rubber"]);
commandToClient(%client, 'InfoSend', %client.backPack["Caps"]);
commandToClient(%client, 'InfoSend', %client.backPack["ScrapMetal"]);
commandToClient(%client, 'InfoSend', %client.backPack["Glass"]);
commandToClient(%client, 'InfoSend', %client.backPack["ScrapElectronics"]);
commandToClient(%client, 'InfoSend', %client.backPack["LightBulb"]);
commandToClient(%client, 'InfoSend', %client.backPack["Wood"]);


    if(!isObject(%object = getWord(containerRaycast(%player.getEyePoint(), vectorAdd(%player.getEyePoint(), vectorScale(%player.getEyeVector(), 7)), $TypeMasks::FxBrickObjectType),0)))
        return;
    %brick = %object;

    if(%object.getDatablock() == brickSingleBottleCapData.getID())
{
%client.backPack["Caps"]++;
messageClient(%client, '',"<font:Arial Bold:25><color:5bb611>[(1) Bottle Cap Added]");
%brick.disappear(32);
}
if(%object.getDatablock() == brickStackBottleCapData.getID())
{
%Amount = (getRandom(10,20));
%client.backPack["Caps"] += %Amount;
messageClient(%client, '',"<font:Arial Bold:25><color:5bb611>[ (" @ %Amount SPC ") Bottle Cap Added]");
%brick.disappear(32);
}

if(%object.getDatablock() == brickTireData.getID())
{
%client.backPack["Rubber"] += 5;
%client.backPack["ScrapMetal"] += 2;
messageClient(%client, '',"<font:Arial Bold:25><color:5bb611>[Rubber Added]");
messageClient(%client, '',"<font:Arial Bold:25><color:5bb611>[Scrap Metal Added]");
%brick.disappear(32);
}

if(%object.getDatablock() == brickNukaBottleData.getID())
{
%client.backPack["Glass"]++;
messageClient(%client, '',"<font:Arial Bold:25><color:5bb611>[Glass Added]");
%brick.disappear(32);
}

if(%object.getDatablock() == brickScrapMetalTeapotData.getID())
{
%client.backPack["ScrapMetal"] += 5;
messageClient(%client, '',"<font:Arial Bold:25><color:5bb611>[(5) Scrap Metal Added]");
%brick.disappear(32);
}

if(%object.getDatablock() == brickBentTincanData.getID())
{
%client.backPack["ScrapMetal"]++;
messageClient(%client, '',"<font:Arial Bold:25><color:5bb611>[Scrap Metal Added]");
%brick.disappear(32);
}

if(%object.getDatablock() == brickTincanData.getID())
{
%client.backPack["ScrapMetal"]++;
messageClient(%client, '',"<font:Arial Bold:25><color:5bb611>[Scrap Metal Added]");
%brick.disappear(32);
}

if(%object.getDatablock() == brickHamRadioData.getID())
{
%client.backPack["ScrapElectronics"]++;
%client.backPack["LightBulb"]++;
messageClient(%client, '',"<font:Arial Bold:25><color:5bb611>[ScrapElectronics Added]");
messageClient(%client, '',"<font:Arial Bold:25><color:5bb611>[Light Bulb Added]");
%brick.disappear(32);
}
if(%object.getDatablock() == brickTV1Data.getID())
{
%client.backPack["Glass"] += 3;
%client.backPack["ScrapElectronics"] += 2;
messageClient(%client, '',"<font:Arial Bold:25><color:5bb611>[(3) Glass Added]");
messageClient(%client, '',"<font:Arial Bold:25><color:5bb611>[(2) Scrap Electronics Added]");
%brick.disappear(32);
}
if(%object.getDatablock() == brickTV1Data.getID())
{
%client.backPack["Wood"] += 5;
messageClient(%client, '',"<font:Arial Bold:25><color:5bb611>[(5) Wood Added]");
%brick.disappear(32);
}


}

Client.cs
Code: [Select]
function clientCmdInfoSend(%this, %client)
{
   %list = ITEMdisplay;
   %list.clear();
   
   %list.addRow(0, "Row one.");
   if(%client.backPack["Glass"] > 0)
   {
      %list.addRow(0, "Row one.");
   }
   if(%client.backPack["Rubber"] > 0)
   {
      %list.addRow(1, "Row two.");
      %list.addRow(2, "Row three.");
   }
}


I think you are misunderstanding the concept of "client"
There is no %client variable when you are on the client side because you are the only client.  Having a %this variable doesn't make sense since this isn't an object oriented function.

clientCmdInfoSend is going to only receive one argument, and that is whatever data is in %client.backPack["Rubber"], or %client.backPack["Caps"], or whatever data you are sending at that particular moment.  You need to transfer the data from the server to the client, you cannot have the client attempt to read variables from some %client object that it doesn't have access to.

I think you are misunderstanding the concept of "client"
There is no %client variable when you are on the client side because you are the only client.  Having a %this variable doesn't make sense since this isn't an object oriented function.

clientCmdInfoSend is going to only receive one argument, and that is whatever data is in %client.backPack["Rubber"], or %client.backPack["Caps"], or whatever data you are sending at that particular moment.  You need to transfer the data from the server to the client, you cannot have the client attempt to read variables from some %client object that it doesn't have access to.
ok so i remove the arguments, wouldnt this send the variables?
Code: [Select]
commandToClient(%client, 'InfoSend', %client.backPack["Rubber"]);
commandToClient(%client, 'InfoSend', %client.backPack["Caps"]);
commandToClient(%client, 'InfoSend', %client.backPack["ScrapMetal"]);
commandToClient(%client, 'InfoSend', %client.backPack["Glass"]);
commandToClient(%client, 'InfoSend', %client.backPack["ScrapElectronics"]);
commandToClient(%client, 'InfoSend', %client.backPack["LightBulb"]);
commandToClient(%client, 'InfoSend', %client.backPack["Wood"]);

ok so i remove the arguments, wouldnt this send the variables?
Code: [Select]
commandToClient(%client, 'InfoSend', %client.backPack["Rubber"]);
commandToClient(%client, 'InfoSend', %client.backPack["Caps"]);
commandToClient(%client, 'InfoSend', %client.backPack["ScrapMetal"]);
commandToClient(%client, 'InfoSend', %client.backPack["Glass"]);
commandToClient(%client, 'InfoSend', %client.backPack["ScrapElectronics"]);
commandToClient(%client, 'InfoSend', %client.backPack["LightBulb"]);
commandToClient(%client, 'InfoSend', %client.backPack["Wood"]);
Yes, but there'd be no way for the client to tell which is which.

You should do something like
Code: (client.cs) [Select]
function clientCmdRecieveMyRPGInfo(%material, %num)
{
//Do stuff.
}
Code: (server.cs) [Select]
commandToClient(%client, 'recieveMyRPGInfo', "Rubber", %client.backPack["Rubber"]);
commandToClient(%client, 'recieveMyRPGInfo', "Caps", %client.backPack["Caps"]);
commandToClient(%client, 'recieveMyRPGInfo', "ScrapMetal", %client.backPack["ScrapMetal"]);
commandToClient(%client, 'recieveMyRPGInfo', "Glass", %client.backPack["Glass"]);
commandToClient(%client, 'recieveMyRPGInfo', "ScrapElectronics", %client.backPack["ScrapElectronics"]);
commandToClient(%client, 'recieveMyRPGInfo', "LightBulb", %client.backPack["LightBulb"]);
commandToClient(%client, 'recieveMyRPGInfo', "Wood", %client.backPack["Wood"]);

Or
Code: (client.cs) [Select]
function clientCmdRecieveMyRPGInfo(%rubber, %caps, %scrapMetal, %glass, %scrapElectronics, %lightBulb, %wood)
{
//Do stuff.
}
Code: (server.cs) [Select]
commandToClient(%client, 'recieveMyRPGInfo', %client.backPack["Rubber"], %client.backPack["Caps"], %client.backPack["ScrapMetal"], %client.backPack["Glass"], %client.backPack["ScrapElectronics"], %client.backPack["LightBulb"], %client.backPack["Wood"]);

I suggest the former though because of the limited number of arguments you can do.
« Last Edit: August 05, 2015, 12:45:33 PM by jes00 »

I suggest the former though because of the limited number of arguments you can do.

I disagree, people with bad latency would be able to notice the lag caused by sending potentially hundreds of packets (although I wont be surprised if torque or something compresses it into one packet anyway). The least lag inducing method would be to compress each argument into a space separated string, then you'll be able to send hundreds or perhaps thousands of arguments in a single packet.

If you're only doing these 7 backpack variables, then it doesn't really matter though. I'm just sensitive to people spamming packets as I've had to suffer from terrible internet most of my life.

I disagree, people with bad latency would be able to notice the lag caused by sending potentially hundreds of packets (although I wont be surprised if torque or something compresses it into one packet anyway). The least lag inducing method would be to compress each argument into a space separated string, then you'll be able to send hundreds or perhaps thousands of arguments in a single packet.

If you're only doing these 7 backpack variables, then it doesn't really matter though. I'm just sensitive to people spamming packets as I've had to suffer from terrible internet most of my life.
commandToServer and commandToClient have limited string sizes too.

commandToServer and commandToClient have limited string sizes too.

Yeah, but I imagine each variable would only be a few digits at most, you could easily send 50 variables in each argument. (btw what is the limit? I keep forgetting. 255?)

commandToServer and commandToClient have limited string sizes too.
255 characters per argument and 21 (i think?) arguments makes 5.3KB of information.

You can have 18 arguments with 255 characters each. i.e. commandToServer('cmd', <18 args w/ 255 chars each>);

Little known fact about the argument count: technically the server accepts 31 arguments since it reads mArgc as 5 bits from the stream, and since the argument buffer has only 21 indices available, it will actually overflow into the next buffer which seems to be an array of StringHandles. This doesn't do anything while the command is processing, however, since the StringHandle destructor tells it to remove it's stored string index, and since the buffer contains arbitrary pointers, it will spam the console with
Error: NetStringTable::removeString() - id \"<random numbers>\" out of range (size = <size>) - about 11 times to be precise. This isn't accessible with just torquescript, though.

ok how do i get the name of the clientCmd? i mean the part right here
Quote
   commandToClient(%client, 'recieveMyRPGInfo', "Rubber", %client.backPack["Rubber"]);


That would call clientCmdrecieveMyRPGInfo("Rubber", %client.backPack["Rubber"]); the bolded part isn't a client command...