Blockland Forums > Modification Help
Need help scripting a resizeme command!
<< < (2/3) > >>
Headcrab Zombie:
Trying to read through your messy indentation:

Why is there a random if inside the package, but outside of a function?
Whats with the second else at the end of the function?
You're missing a { between the serverCmdResizeme(...) and the if
frogger3140:
This is the fix?


--- Code: ---//RP Enhancements v0 patch 3.3
//THIS ADD-ON WILL NOT WORK WITH FFC
//Made by Frogger3140
//Current Commands: /ResizeMe

package RP_Enhancements
{
if(isFile("Add-Ons/System_ReturnToBlockland/server.cs"))
{
RTB_registerPref("Resize Me", "RP Enhancements", "RPE::ResizeMe", "int 0 1", "Script_RPE", 1, 0, 0);
}
else
{
$RPE::ResizeMe = 1;
}
}
function serverCmdResizeMe(%client,%ResizerX,%ResizerY,%ResizerZ)
{
if($RPE::ResizeMe == 1)
{
%client.player.setPlayerScale(%ResizerX SPC %ResizerY SPC %ResizerZ)
echo(%client SPC " used the resizeme command to resize to" %ResizerX SPC "," SPC %ResizerY SPC "," SPC "," %ResizerZ "!");
}
else
{
messageClient(%client,''."ResizeMe is disabled!"
}
}
};
activatepackage(RP_Enhancements);


--- End code ---

EDIT: Still getting the error, tried to fix the code

--- Quote from: Headcrab Zombie on November 26, 2010, 12:04:21 AM ---Trying to read through your messy indentation:

Why is there a random if inside the package, but outside of a function?
Whats with the second else at the end of the function?
You're missing a { between the serverCmdResizeme(...) and the if

--- End quote ---
I needed a FFC Check because FFC will conflict with this command, and that's why there's the random if and second else.
EDIT: Error handling is being too harsh, removing the FFC Check,
EDIT: NOW THE RTB CHECK IS HALTING, that's loving it, rewriting the stuff.

--- Code: ---
package RP_Enhancements
{
if(##i##sFile("Add-Ons/System_ReturnToBlockland/server.cs"))
{
RTB_registerPref("Resize Me", "RP Enhancements", "RPE::ResizeMe", "int 0 1", "Script_RPE", 1, 0, 0);
}
else
{
$RPE::ResizeMe = 1;
}
}
function serverCmdResizeMe(%client,%ResizerX,%ResizerY,%ResizerZ)
>>> Error report complete.

ADD-ON "Script_RPE" CONTAINS SYNTAX ERRORS

--- End code ---
Uristqwerty:
Packages might only be able to contain functions. Put them before/after the package.
There should be a line with a { after the line with function serverCmdResizeMe(%client,%ResizerX,%ResizerY,%ResizerZ)
You cannot have more than one else.
You cannot conditionally define functions, except by conditionally execing a file, or possibly conditionally activating a package.
Your test for FFC was wrong, it would cause an error if FFC was NOT there.


--- Code: ---
package RP_Enhancements
{
    function serverCmdResizeMe(%client,%ResizerX,%ResizerY,%ResizerZ)
    {
        if($RPE::ResizeMe == 1)
        {
            %client.player.setPlayerScale(%ResizerX SPC %ResizerY SPC %ResizerZ)
            echo(%client SPC " used the resizeme command to resize to" %ResizerX SPC "," SPC %ResizerY SPC "," SPC "," %ResizerZ "!");
        }
        else
        {
            messageClient(%client,''."ResizeMe is disabled!"
        }
    }
};

if(!isFile("Add-Ons/Script_FFC/server.cs"))
{
    activatepackage(RP_Enhancements);

    if(isFile("Add-Ons/System_ReturnToBlockland/server.cs"))
    {
        RTB_registerPref("Resize Me", "RP Enhancements", "RPE::ResizeMe", "int 0 1", "Script_RPE", 1, 0, 0);
    }
    else
    {
        $RPE::ResizeMe = 1;
    }
}
else
{
    error("RP_Enhancements Conflict: Please remove Fooly Fun Commands for this to work!");
}


--- End code ---

Consider checking if FFC was disabled if it existed, not just if it existed. Also, this code looks abusable and doesn't seem to add anything to the game, so I would not reccomend releasing it publicly.
Chrono:

--- Quote from: Uristqwerty on November 26, 2010, 11:44:24 AM ---Packages might only be able to contain functions.

--- End quote ---
This is true. Packages are strictly for functions.
Crysist:

--- Quote ---        {
            messageClient(%client,''."ResizeMe is disabled!"
        }
--- End quote ---
Forgot to put the ); at the end, and also, should the ''. be there, or not? Or should the period be a ,?
Hmmm

--- Quote ---       {
            messageClient(%client,"ResizeMe is disabled!");
        }
--- End quote ---
Navigation
Message Index
Next page
Previous page

Go to full version