So I'm beginning to program things in TorqueScript, and I'm trying to make a serverCmd function.
function serverCmdRules(%client, %ruleNum) {
if(!ruleNum) {
messageClient(%client, ' ', "[unimportant message]");
return;
}
switch(%ruleNum) {
case 1:
messageClient(%client, '', "Rule #1");
case 2:
messageClient(%client, '', "Rule #2");
case 3:
messageClient(%client, '', "Rule #3");
// so on . . .
default:
messageClient(%client, '', "[another unimportant message]");
}
}
What I want it to do is when I type '/rules' it will display the unimportant message. When you type '/rules 1' I would want it to skip the unimportant message and display the info about the rule.
So when I type '/rules' that part does as I want, but when I type '/rules 1' it still only displays the unimportant message and doesn't display the info about the rule. When I execute the file, the console says that the 2nd line always defaults to 0, but I'm not sure how to fix this.
All help would be appreciated.