Author Topic: How to make this script?  (Read 6406 times)

Yeah, I wasn't exactly sure of that part. Can't you still reference it as %variable[4] even if it is really named %variable4?
%variable[4] is the same thing as %variable4.

==>%var[4] = "Oh hey look I'm a var"; echo(%variable4);
Oh hey look I'm a var

Script had a syntax error. Hmmm

   $AvatarCycleSchedule schedule(##5##000, 0, AvatarCycle, %avatar);

You need an equal sign here, you're setting $AvatarCycleSchedule equal to that schedule. Just put a = between the two.

Code: [Select]
function AvatarCycle(%avatar)
{
cancel($AvatarCycleSchedule);
%avatar++;
if(%avatar > 3)
%avatar = 1;
AvatarGui.Clickfav(%avatar);
Avatar_done();
$AvatarCycleSchedule = schedule(5000, 0, "AvatarCycle", %avatar);
}
Missing "f" before the unction
Also added "cancel($AvatarCycleSchedule);" //I don't know if that's needed
Missing quotation marks and the equal sign on the schedule

   $AvatarCycleSchedule schedule(##5##000, 0, AvatarCycle, %avatar);

You need an equal sign here, you're setting $AvatarCycleSchedule equal to that schedule. Just put a = between the two.
Still didnt work. Here is the console log.
Code: [Select]
function AvatarCycle(%avatar)
{
cancel($AvatarCycleSchedule);
%avatar++;
if(%avatar > 3)
%avatar = 1;
AvatarGui.Clickfav(%avatar);
Avatar_done();
$AvatarCycleSchedule = schedule(5000, 0, "AvatarCycle", %avatar);
}
Missing "f" before the unction
Also added "cancel($AvatarCycleSchedule);" //I don't know if that's needed
Missing quotation marks and the equal sign on the schedule
Strangely in the script it DOES have the f.

OFF TOPIC: Why does it say I have a Intel Pentium III? Does that stand for i3? I have an i3.
« Last Edit: July 16, 2014, 10:54:34 PM by Naked Human »

None of those things were needed, but none of them are particularly unnecessary. The "f" was cut off because Torque only shows a certain amount of characters prior to and after the error. f simply didn't make it in the console.log, it is in the script. The cancel() can eliminate the chances of Torque doing this weird thing it does where multiple schedules end up running simultaneously somehow and call the function more frequently than it's supposed to be. It's kind of helpful, but it shouldn't need to be there. As for the quotes, absolutely unnecessary because Torque automatically stringifies everything, but w/e.

The equal sign goes before "schedule" in the script, not after. This is what the game says you have:

   $AvatarCycleSchedule schedule = (5000, 0, AvatarCycle, %avatar);

If you're developing out of a .zip file, it's entirely possible that this is Blockland's fault. It's one of the reasons you shouldn't develop out of a .zip, just use a normal folder.

The equal sign goes before "schedule" in the script, not after. This is what the game says you have:

   $AvatarCycleSchedule schedule = (5000, 0, AvatarCycle, %avatar);

If you're developing out of a .zip file, it's entirely possible that this is Blockland's fault. It's one of the reasons you shouldn't develop out of a .zip, just use a normal folder.
That seemed to fix the problem but the script itself does not work. My avatar stays the same. Is it possible I need to say a command in the console to activate it? I appreciate your patience. If you guys want I can upload it to mediafire or something.

WAIT! I kept loading it in freebuild. I think it was supposed to be in custom.

EDIT: Nope that didnt work either :/.
« Last Edit: July 16, 2014, 11:02:28 PM by Naked Human »

You definitely do have to enter something in console to activate it!

avatarCycle();

If you want, you can just add that onto the end of your script so it automatically activates it. I think it'd be better if you didn't though.

You definitely do have to enter something in console to activate it!

avatarCycle();

If you want, you can just add that onto the end of your script so it automatically activates it. I think it'd be better if you didn't though.
It worked!! Although it created A TON of errors. Though the script still works. I probably won't add it to the automatic activation either. gameplay
« Last Edit: July 16, 2014, 11:22:21 PM by Naked Human »

WAIT! I kept loading it in freebuild. I think it was supposed to be in custom.
As this is a client-side script, it should be put in a client.cs, not a server.cs
client.cs files always load, no matter what server you're in

It worked!! Although it created A TON of errors. Though the script still works
Post the errors

Post the errors
I did, the console log. Which I just posted so I assume you didnt see it :p.
« Last Edit: July 16, 2014, 11:16:53 PM by Naked Human »

Ok either the spamming errors or the script is causing a problem where I cant open the Options menu. When the avatar changes the options menu closes and goes back the Esc menu.

EDIT: Ok I dont know wtf is happening. Script is now working PERFECTLY. No errors or problems. Thanks all, And I somehow fixed the problem by changing the avatars' appearances. Strange
« Last Edit: July 16, 2014, 11:32:23 PM by Naked Human »

Ok either the spamming errors or the script is causing a problem where I cant open the Options menu. When the avatar changes the options menu closes and goes back the Esc menu.
Yeah it does that. Closing the menu is part of the avatar_done() function