View Single Post
  #10  
Old 12-16-2011, 04:22 PM
callimuc callimuc is offline
callimuc's Avatar
Join Date: Nov 2010
Location: Germany
Posts: 1,015
callimuc is a splendid one to beholdcallimuc is a splendid one to beholdcallimuc is a splendid one to beholdcallimuc is a splendid one to beholdcallimuc is a splendid one to behold
You could also short the script by doing something like this

PHP Code:
function onKeyPressed(codekey) {
  if (
key == "b") {
    if (
this.boots == false) {
      
this.boots true;
      
player.chat "Boots on!";
    }
    else if (
this.boots == true) {
      
this.boots false;
      
player.chat "Boots off!";
    }
  }

OR

PHP Code:
function onKeyPressed(codekey) {
  if (
key == "b") {
    
this.boots = !this.boots//change boolean
    
player.chat "Boots "@ (this.boots"on!" "off!"); //boots are on or off
  
}

Well with the
PHP Code:
this.boots = !this.boots
is something like gunderak said. It changes the boolean (true to false or false to true). Gunderaks post might also help.

And
PHP Code:
(this.boots "on!" "off!"); 
is also very nice (in my opinion). Itīs like also checking the boolean. This example might help
PHP Code:
player.chat this.booleancheck "The boolean is true!" "The boolean is false!";

//or

this.booleancheck BooleanTrue() : BooleanFalse();
  
//if the statement is true, start the function "BooleanTrue()" else if the
  //statement is false, start the function "BooleanFalse()"

function BooleanTrue() {
  
player.chat "The boolean is true!";
}

function 
BooleanFalse() {
  
player.chat "The boolean is false!";


If there are any questions or suggestions about this just ask
__________________
MEEP!
Reply With Quote