Author Topic: How to make a GUI  (Read 4444 times)


It is a value written to the user's client with VCE

Ok then
Code: [Select]
function servercmdtycooninfo(%client)
{
%money = VariableGroup_10630.value["Client", %client.getid(), "money"];
if(%money $= "") %money = "None";

%tycoon = VariableGroup_10630.value["Client", %client.getid(), "tycoon"];
if(%tycoon $= "") %tycoon = "None";

%vip = VariableGroup_10630.value["Client", %client.getid(), "VIP"];
if(%vip $= "") %vip = "No";

%message = "<just:left>Your stats:\n\nMoney:" SPC %money @ "\nTycoon:" SPC %tycoon @ "\nVIP Access:" SPC %vip;

commandtoclient(%client, 'messageboxok', "Light Tycoon by Yin Yang", %message);
}

registeroutputevent("GameConnection", "TycoonInfo");
function gameconnection::tycooninfo(%this){servercmdtycooninfo(%this);}
That code would, if a client says /tycooninfo, make a box pop up for him telling him his money, tycoon status, and vip access.
You could obviously add more values to it.

Let's look what the code does:

Code: [Select]
function servercmdtycooninfo(%client)
Create a slash command.

Code: [Select]
%money = VariableGroup_10630.value["Client", %client.getid(), "money"];
Get the VCE value of the money.
VCE stores values in variable groups suffixed with the bl_id of the owner of the brick that the VCE event is used on, in this case that is your bl_id
We now get the client's money variable by getting the field that has the type of variable (Client), the object ID of the client and the variable name,
so in this case that would i.e. return VariableGroup_10630.valueClient_13376_money

Code: [Select]
if(%money $= "") %money = "None";
In case the VCE value doesn't exist yet (client just spawned) we set it to None otherwise the box would just display Money:

Code: [Select]
%message = "<just:left>Your stats:\n\nMoney:" SPC %money @ "\nTycoon:" SPC %tycoon @ "\nVIP Access:" SPC %vip;
Assemble the message.
The message would for example be this:
Your stats:

Money: 1337
Tycoon: 5
VIP Access: Yes


Code: [Select]
commandtoclient(%client, 'messageboxok', "Light Tycoon by Yin Yang", %message);
Tell the client to open the gui box and display the message.

Code: [Select]
registeroutputevent("GameConnection", "TycoonInfo");
function gameconnection::tycooninfo(%this){servercmdtycooninfo(%this);}
Optional:
Register an output event so you can with make i.e. a sign display the box with onActivate->Client->TycoonInfo


The box would look like this with the ugly default gui style:


However this method would display a GUI but not require any client-sided add-ons which noone would download soo

Blocklands ugly guis can however be fixed by using client-sided gui add-ons such as white style:


I just spent a bit of time writing all this I hope it is useful
« Last Edit: March 22, 2013, 03:08:32 PM by Zeblote »

The box would look like this with the ugly default gui style:


However this method would display a GUI but not require any client-sided add-ons which noone would download soo

Blocklands ugly guis can however be fixed by using client-sided gui add-ons such as my white style:


"hey look at me I can make basic GUIs I'm so cool use them you cigarettes"

"hey look at me I can make basic GUIs I'm so cool use them you cigarettes"
yes pls

"hey look at me I can make basic GUIs I'm so cool use them you cigarettes"

Well his new GUI does seem better formatted, with the title borders and better window borders and what-not. The font does fit in nicely too. Heck, I would do anything to get that GUI, or atleast learn how to create one of my own.

Well his new GUI does seem better formatted, with the title borders and better window borders and what-not. The font does fit in nicely too. Heck, I would do anything to get that GUI, or atleast learn how to create one of my own.

Forcefully advertising it in a 100% unrelated topic is really a bitch move though.

Forcefully advertising it in a 100% unrelated topic is really a bitch move though.

Where was he advertising it? I think he only mentioned it twice, and he's just giving out ideas.

Forcefully advertising it in a 100% unrelated topic is really a bitch move though.
I removed the "my"
I was giving an example that the box might not look that ugly for everyone

Code: [Select]
function servercmdtycooninfo(%client)
{
%money = VariableGroup_10630.value["Client", %client.getid(), "money"];
if(%money $= "") %money = "None";

%tycoon = VariableGroup_10630.value["Client", %client.getid(), "tycoon"];
if(%tycoon $= "") %tycoon = "None";

%vip = VariableGroup_10630.value["Client", %client.getid(), "VIP"];
if(%vip $= "") %vip = "No";

%message = "<just:left>Your stats:\n\nMoney:" SPC %money @ "\nTycoon:" SPC %tycoon @ "\nVIP Access:" SPC %vip;

commandtoclient(%client, 'messageboxok', "Light Tycoon by Yin Yang", %message);
}

registeroutputevent("GameConnection", "TycoonInfo");
function gameconnection::tycooninfo(%this){servercmdtycooninfo(%this);}
Why thank you, it infact is, i think i can figure out how to implement it,
"hey look at me I can make basic GUIs I'm so cool use them you cigarettes"
At least Zeblote tryed to help, Port. You did not.

i think i can figure out how to implement it,
Create a new folder in documents/blockland/add-ons
Create a new text file, rename it to server.cs, place that code in it, save file, put in the folder
Create another text file, rename it description.txt, put in same folder
Call the folder script_tycoon or something

Or just put the code in a random cs file to the code for some other add-on you are using

Create a new folder in documents/blockland/add-ons
Create a new text file, rename it to server.cs, place that code in it, save file, put in the folder
Create another text file, rename it description.txt, put in same folder
Call the folder script_tycoon or something

Or just put the code in a random cs file to the code for some other add-on you are using
Why thank you