Author Topic: [MOVED]How the hell do I fix this syntax  (Read 468 times)

So, I've been trying to get into torquescript recently, and wanted to make a little script to roll a dice with a max output defined by the user, but I kept having problems with the script:
Code: [Select]
function servercmdRoll(%maxvalue)
{
%output = getrandom(1,%maxvalue);
messageClient(%client,"","has rolled"@ %output @"out of"@ %maxvalue @"!"*");
}
When I start a single player server, the game flips out and refuses to load it, giving me this:
Code: [Select]
Loading Add-On: Script_Roll (CRC:1566994399)
Add-Ons/Script_Roll/server.cs Line: 4 - Syntax error.
>>> Some error context, with ## on sides of error halt:
unction servercmdRoll(%maxvalue)

{

^%output = getrandom(1,%maxvalue);

^messageClient(%client,"","has rolled"@ %output @"out of"@ %maxvalue @"!"*");
##
##};
>>> Error report complete.

ADD-ON "Script_Roll" CONTAINS SYNTAX ERRORS
There's nothing where the error halt is.
What'd I do wrong/how do I fix this?

also, is there a better way to print the output?I've basically just been looking at snippets of other scripts that have outputs like this and I get the feeling there's a better way to do this.
(also i want to make it message all(i tried announce(%1"","has rolled"@ %output @"out of"@ %maxvalue @"!"*") but I wasn't sure if using %1 would output it correctly, so i changed it to messageClient and used %client instead just so i could make sure it worked first))
« Last Edit: April 11, 2015, 07:20:20 PM by AutoBahn »

wait a second i meant to post this in the coding help subforum, how'd it get here