Blockland Forums > Modification Help
"/" command help
Baeshra:
If you could tell me how to add keybinds I'd gladly do it.
Fluff-is-back:
--- Code: ---$remapDivision[$remapCount] = "Section Title";
$remapName[$remapCount] = "Bind Title";
$remapCmd[$remapCount] = "function";
$remapCount++;
--- End code ---
Would make a keybind Called Bind Title under Section Title that when activated will execute the command: function();
If you wanted to add two binds to the same section:
--- Code: ---$remapDivision[$remapCount] = "Some Section";
$remapName[$remapCount] = "Bind1";
$remapCmd[$remapCount] = "function";
$remapCount++;
$remapName[$remapCount] = "Bind2";
$remapCmd[$remapCount] = "function";
$remapCount++;
--- End code ---
Baeshra:
Ok, I just added the keybind like you said to but now nothing works, here's my current script...
--- Code: ---///Colored Avatar
//by boomlinde
//Edited by Tylerman
//Re-edited by Erif/Baeshra/BL_ID 19049
{
$remapDivision[$remapCount] = "Rainbow Avatar";
$remapName[$remapCount] = "Toggle Head";
$remapCmd[$remapCount] = "togglehead";
$remapCount++;
}
if (!$RainbowAvatarBindings)
{
$remapDivision[$remapCount] = "Rainbow Avatar";
$remapName[$remapCount] = "Activate/Deactivate";
$remapCmd[$remapCount] = "RainbowAvatarToggle";
$remapCount++;
$RainbowAvatarBindings=true;
}
$RainbowAvatarCount=0;
$RainbowAvatarFlag=0;
$RainbowAvatarTempPack=$pref::Avatar::PackColor;
$RainbowAvatarTempHat=$pref::Avatar::HatColor;
$RainbowAvatarTempLLeg=$pref::Avatar::LLegColor;
$RainbowAvatarTempRLeg=$pref::Avatar::RLegColor;
$RainbowAvatarTempAccent=$pref::Avatar::AccentColor;
funtion togglehead
{
$RainbowAvatarTempHead=$pref::Avatar::HeadColor;
}
$RainbowAvatarTempTorso=$pref::Avatar::TorsoColor;
$RainbowAvatarTempHip=$pref::Avatar::HipColor;
$RainbowAvatarTempLArm=$pref::Avatar::LArmColor;
$RainbowAvatarTempLHand=$pref::Avatar::LHandColor;
$RainbowAvatarTempRArm=$pref::Avatar::RArmColor;
$RainbowAvatarTempRHand=$pref::Avatar::RHandColor;
$RainbowAvatarTempSecondPack=$pref::Avatar::SecondPackColor;
function RainbowAvatarToggle(%val)
{
if(%val) {
if($RainbowAvatarFlag==0)
{
$RainbowAvatarFlag=1;
$RainbowAvatarTempPack=$pref::Avatar::PackColor;
$RainbowAvatarTempHat=$pref::Avatar::HatColor;
$RainbowAvatarTempLLeg=$pref::Avatar::LLegColor;
$RainbowAvatarTempRLeg=$pref::Avatar::RLegColor;
$RainbowAvatarTempAccent=$pref::Avatar::AccentColor;
funtion togglehead
{
$RainbowAvatarTempHead=$pref::Avatar::HeadColor;
}
$RainbowAvatarTempTorso=$pref::Avatar::TorsoColor;
$RainbowAvatarTempHip=$pref::Avatar::HipColor;
$RainbowAvatarTempLArm=$pref::Avatar::LArmColor;
$RainbowAvatarTempLHand=$pref::Avatar::LHandColor;
$RainbowAvatarTempRArm=$pref::Avatar::RArmColor;
$RainbowAvatarTempRHand=$pref::Avatar::RHandColor;
$RainbowAvatarTempSecondPack=$pref::Avatar::SecondPackColor;
RainbowAvatarLoop();
}
else if($RainbowAvatarFlag==1)
{
$RainbowAvatarFlag=0;
cancel($RainbowAvatar);
$pref::Avatar::PackColor=$RainbowAvatarTempPack;
$pref::Avatar::HatColor=$RainbowAvatarTempHat;
$pref::Avatar::LLegColor=$RainbowAvatarTempLLeg;
$pref::Avatar::RLegColor=$RainbowAvatarTempRLeg;
$pref::Avatar::AccentColor=$RainbowAvatarTempAccent;
funtion togglehead
{
$pref::Avatar::HeadColor=$RainbowAvatarTempHead;
}
$pref::Avatar::TorsoColor=$RainbowAvatarTempTorso;
$pref::Avatar::HipColor=$RainbowAvatarTempHip;
$pref::Avatar::LArmColor=$RainbowAvatarTempLArm;
$pref::Avatar::LHandColor=$RainbowAvatarTempLHand;
$pref::Avatar::RArmColor=$RainbowAvatarTempRArm;
$pref::Avatar::RHandColor=$RainbowAvatarTempRHand;
$pref::Avatar::SecondPackColor=$RainbowAvatarTempSecondPack;
clientcmdupdateprefs();
}
}
}
function rainbowreset() {
cancel($RainbowAvatar);
$pref::Avatar::PackColor=$RainbowAvatarTempPack;
$pref::Avatar::HatColor=$RainbowAvatarTempHat;
$pref::Avatar::LLegColor=$RainbowAvatarTempLLeg;
$pref::Avatar::RLegColor=$RainbowAvatarTempRLeg;
$pref::Avatar::AccentColor=$RainbowAvatarTempAccent;
funtion togglehead
{
$pref::Avatar::HeadColor=$RainbowAvatarTempHead;
}
$pref::Avatar::TorsoColor=$RainbowAvatarTempTorso;
$pref::Avatar::HipColor=$RainbowAvatarTempHip;
$pref::Avatar::LArmColor=$RainbowAvatarTempLArm;
$pref::Avatar::LHandColor=$RainbowAvatarTempLHand;
$pref::Avatar::RArmColor=$RainbowAvatarTempRArm;
$pref::Avatar::RHandColor=$RainbowAvatarTempRHand;
$pref::Avatar::SecondPackColor=$RainbowAvatarTempSecondPack;
clientcmdupdateprefs();
}
function RainbowAvatarLoop()
{
if($RainbowAvatarCount > 63) $RainbowAvatarCount=0;
//Grejer
$R=0.5+0.5*mSin($RainbowAvatarCount*3.14/16.0);
$G=0.5+0.5*mSin($RainbowAvatarCount*3.14/16.0+21.0);
$pref::Avatar::PackColor=$R SPC $G SPC $B SPC "1";
$pref::Avatar::HatColor=$R SPC $G SPC $B SPC "1";
$pref::Avatar::LLegColor=$R SPC $G SPC $B SPC "1";
$pref::Avatar::RLegColor=$R SPC $G SPC $B SPC "1";
$pref::Avatar::AccentColor=$R SPC $G SPC $B SPC "1";
funtion togglehead
{
$pref::Avatar::HeadColor=$R SPC $G SPC $B SPC "1";
}
$pref::Avatar::TorsoColor=$R SPC $G SPC $B SPC "1";
$pref::Avatar::HipColor=$R SPC $G SPC $B SPC "1";
$pref::Avatar::LArmColor=$R SPC $G SPC $B SPC "1";
$pref::Avatar::LHandColor=$R SPC $G SPC $B SPC "1";
$pref::Avatar::RArmColor=$R SPC $G SPC $B SPC "1";
$pref::Avatar::RHandColor=$R SPC $G SPC $B SPC "1";
$pref::Avatar::SecondPackColor=$R SPC $G SPC $B SPC "1";
clientcmdupdateprefs();
$RainbowAvatarCount++;
$RainbowAvatar=schedule(250,0,RainbowAvatarLoop);
--- End code ---
I'm not sure whats wrong so please help.
Nexus:
--- Quote from: Baeshra on January 08, 2011, 09:50:03 PM ---Ok, I just added the keybind like you said to but now nothing works, here's my current script...
I'm not sure whats wrong so please help.
--- End quote ---
Well, first of all the code does not look complete. To put it in simple terms, if a block of code is opened with a "{", then it must be closed with a "}". That means you code must end with a }, which it clearly does not. Also, you didn't add a serverCmd at all, did you change your mind? AlsoAlso: blockland has a very nice syntax debugger when you start up your server. after closing the server, you look at the console.txt and look for when it executes your addon. If it found a syntax error, it puts that error in a ##error## box.
Gadgethm:
In that code you have two key bindings, which one are you going to use? Also, you have empty parentheses, {} like that.
You really don't need to mess with that code that you had, it looks like it already had bindings.