Read the Basics, willing to work hard to make this addon.

Author Topic: Read the Basics, willing to work hard to make this addon.  (Read 1523 times)

Got the hang of packaging and variables and loops, now want to make a skybox changer in the command line rather than use a GUI.

Any tips on how to start?

Pseudo-Syntax:
Code: [Select]
/skychange "Sky_Sunset"
SKYCHANGER: CHANGED TO SKY_SUNSET, TYPE: sunset4.jpg

for server commands, use
Code: [Select]
function serverCommandskychange(%client, %skybox)
{
<code>
}
%client is the client calling the method, you should probably check if they're admin if you want to limit the command to admins only
%skybox will be the user input for which skybox to change it to

not sure what the skybox functions are, but you could try running a trace and changing the skybox with the GUI, it may tell you which functions to call

for server commands, use
Code: [Select]
function serverCommandskychange(%client, %skybox)
{
<code>
}
%client is the client calling the method, you should probably check if they're admin if you want to limit the command to admins only
%skybox will be the user input for which skybox to change it to

not sure what the skybox functions are, but you could try running a trace and changing the skybox with the GUI, it may tell you which functions to call

thanks for your help, will try that.

not sure what the skybox functions are, but you could try running a trace and changing the skybox with the GUI, it may tell you which functions to call
function setSkyBox(%filename)

function setSkyBox(%filename)

saved my ass bro, been trying to find this thanks

function serverCommandskychange(%client, %skybox)
{
   function setSkyBox(%filename);
}

Am I on the right track here?

you only need to write function when declaring a function
not when calling it

you also don't have %filename declared
i'm guessing you want it to be the user input, %skybox, or change the name of the user's input to %filename

Code: [Select]
function serverCommandskychange(%client, %skybox)
{
setSkyBox(%skybox);
}
or
Code: [Select]
function serverCommandskychange(%client, %filename)
{
setSkyBox(%filename);
}

do note that this will let anybody in the server be able to change the skybox
you may want to look into making it admin only

you only need to write function when declaring a function
not when calling it

you also don't have %filename declared
i'm guessing you want it to be the user input, %skybox, or change the name of the user's input to %filename

Code: [Select]
function serverCommandskychange(%client, %skybox)
{
setSkyBox(%skybox);
}
or
Code: [Select]
function serverCommandskychange(%client, %filename)
{
setSkyBox(%filename);
}

do note that this will let anybody in the server be able to change the skybox
you may want to look into making it admin only

Thank you. Will try this now.

Function works, any possible way to do it the way I first mentioned it?

/skychange "Sky_Sunset"
SKYCHANGER: CHANGED TO SKY_SUNSET, TYPE: sunset4.jpg

aka without having to input Add-Ons/Skybox_Name/skybox.dml

you only need to write function when declaring a function
not when calling it

you also don't have %filename declared
i'm guessing you want it to be the user input, %skybox, or change the name of the user's input to %filename

Code: [Select]
function serverCommandskychange(%client, %skybox)
{
setSkyBox(%skybox);
}
or
Code: [Select]
function serverCommandskychange(%client, %filename)
{
setSkyBox(%filename);
}

do note that this will let anybody in the server be able to change the skybox
you may want to look into making it admin only

Function works, any possible way to do it the way I first mentioned it?

/skychange "Sky_Sunset"
SKYCHANGER: CHANGED TO SKY_SUNSET, TYPE: sunset4.jpg

aka without having to input Add-Ons/Skybox_Name/skybox.dml

Yeah. You can take the users input and put the path around it like so:
%skybox = "Add-Ons/Sky_" @ %skybox @ "/" @ %skybox @ ".dml";

If you don't understand how I'm connecting strings like that, take a look at this. It's for the newer version of Torque but still explains things well.

You should also figure out how to use the isFile() function to check if the skybox exists before applying it.

Yeah. You can take the users input and put the path around it like so:
%skybox = "Add-Ons/Sky_" @ %skybox @ "/" @ %skybox @ ".dml";

If you don't understand how I'm connecting strings like that, take a look at this. It's for the newer version of Torque but still explains things well.

You should also figure out how to use the isFile() function to check if the skybox exists before applying it.


Thanks a bundle my man this saved me time browsing the docs. I was thinking something like this but didnt know the proper syntax on how to connect the strings. So used to python's "+" operator to concatenate. Thank you.

try looking at addons that have similar functionality to what you want
for a global message sent to everybody, there are plenty of addons that do this
one example is the clear spam addon, it does some logic for clearing spam bricks and also prints a message to everybody in the server
it also has a check for if the client is an admin