Author Topic: CityRP Help  (Read 936 times)

I'm currently editing Jookia's CityRP (no hunger mod, clothes or fancy stuff of the sort). I need to know how to use variables in TorqueScript. I want it so when a user places a lot, it sets a variable to 1. If all of the users lots are removed (having no lots) the variable switches to 1. This is always clientsided so the only way to change the variable is from changing your number of lots to and from zero. Another thing. I need the variable to be testable (ifVariable) through VCE events. When VCE comes out, I will be able to stop other players from using this variable for safety.
One last thing. How do I prevent events from functioning for NON ADMINS?
Thanks.

Variables:
Code: [Select]
%(local Variable)
$(global Variable)

If the player is not an admin and you don't want him to do the function...

You must have client as a variable, then...

Code: [Select]
if(!%client.isAdmin || %client.isSuperAdmin)
return

I'm really new to TorqueScript, so 3 questions:

1, what's the difference between Local and Global variables?
2, what does return do?
3, are the variables editable through VCE?

I'm really new to TorqueScript, so 3 questions:

1, what's the difference between Local and Global variables?
2, what does return do?
3, are the variables editable through VCE?
1. Local is within a function or assigned to an object. Global is, like, server prefs and things like that.
2. i cant really explain it, can someone else do that? ._.'
3. no, vce variables work differently.

edit:

Torque is not going to come so easily as you seem to want it to. It takes time, but we'd be glad to help you get on your feet.

I need it checkable through VCE (IfVariable)

Return, does this:
First it can stop a function, and just end it's execution.
For example...
Code: [Select]
function returntest(%a)
{
echo("Statement one.");
if(%a==1)
return;
echo("Statement two.");
}
If that function is passed with %a as a 1 then it will 'return' where it says return, if not it won't, so it would output "statement one" and "statement two" if %a is not equal to 1 and if it is equal to one it would just output "statement one".

Return can also be used to make functions 'return' variables:
Code: [Select]
function anothertest(%a)
{
return %a/1.2;
}
Now you could use "anothertest(<var>);" for example, to do work for you, for example:
Code: [Select]
echo(anothertest(5));
Would print out 5*1.2 in the console.

-snip-
English, please.

I guess TorqueScript just isn't for me...

English, please.

I guess TorqueScript just isn't for me...

You just need to start off simple, then work your way up.

English, please.

I guess TorqueScript just isn't for me...
Torque is not going to come so easily as you seem to want it to. It takes time, but we'd be glad to help you get on your feet.

1. Local is within a function or assigned to an object. Global is, like, server prefs and things like that.

...
Local variables are variables that are removed from their current scope when it is destroyed.
Example, the eval call it was used in ends, it's function is over, etc.
Global variables are variables that are constantly consistent, only removed when the 'deleteVariables' function is called with a mask that matches the variable.
Field variables are variables that are assigned to an object, and are removed when the object is destroyed.

...
Local variables are variables that are removed from their current scope when it is destroyed.
Example, the eval call it was used in ends, it's function is over, etc.
Global variables are variables that are constantly consistent, only removed when the 'deleteVariables' function is called with a mask that matches the variable.
Field variables are variables that are assigned to an object, and are removed when the object is destroyed.
e

Yeah, I can't explain things like what he's asking very well

HAI GUISE NEVR DONE TORQUE LOL WUT PROGRAM DEW EY YEWS

HAI GUISE NEVR DONE TORQUE LOL WUT PROGRAM DEW EY YEWS
that isn't funny or productive

but I use notepad.  :cookieMonster: