Graal Forums

Graal Forums (https://forums.graalonline.com/forums/index.php)
-   New Scripting Engine (GS2) (https://forums.graalonline.com/forums/forumdisplay.php?f=153)
-   -   Boots (https://forums.graalonline.com/forums/showthread.php?t=82800)

Pelikano 11-16-2008 10:45 PM

Boots
 
Hello, once again I need some help.
I am trying to script my own boots.. but it doesn't work for some reason:

NPC Code:
//#CLIENTSIDE
function onWeaponFired() {
if (this.disabled == false) {
disabledefmovement();
this.disabled = true;
setTimer(0.05);
}elseif (this.disabled = true)
enabledefmovement();
setTimer(0);
}
function onTimeout() {
for (i = 0; i < 4; i++) {
if (keydown(i)) {
player.dir = i;
player.x += vecx(player.dir);
player.y += vecy(player.dir);
}
}
setTimer(0.05);
}



Any idea why?

Tigairius 11-16-2008 11:03 PM

Quote:

Originally Posted by Pelikano (Post 1442781)
Hello, once again I need some help.

PHP Code:

//#CLIENTSIDE

function onWeaponFired() {

  if (
this.disabled == false) {

    
disabledefmovement();

    
this.disabled true;

    
setTimer(0.05);

   }elseif (
this.disabled == true) {

      
enabledefmovement();

      
setTimer(0);
  }

}

function 
onTimeout() {

  for (
04i++) {

    if (
keydown(i)) {

      
player.dir i;

      
player.+= vecx(player.dir);

      
player.+= vecy(player.dir);

    }

  }

      
setTimer(0.05);




LoneAngelIbesu 11-16-2008 11:22 PM

To reiterate your mistake, you omitted a necessary bracket at the end of onWeaponFired().

Bl0nkt 11-18-2008 07:27 AM

Quote:

Originally Posted by Pelikano (Post 1442781)
Hello, once again I need some help.
I am trying to script my own boots.. but it doesn't work for some reason:

NPC Code:
//#CLIENTSIDE
function onWeaponFired() { 1
if (this.disabled == false) { 2
disabledefmovement(); 3
this.disabled = true; 4
setTimer(0.05); 5
}elseif (this.disabled = true) 6
enabledefmovement(); 7
setTimer(0); 8
} 9
function onTimeout() { 10
for (i = 0; i < 4; i++) { 11
if (keydown(i)) { 12
player.dir = i; 13
player.x += vecx(player.dir); 14
player.y += vecy(player.dir); 15
} 16
} 17
setTimer(0.05); 18
} 19



Any idea why?

Okay, I've added numbers to each of the lines so I can explain easier.

Problem 1: On line 6, you only have "=" when the operator should be "==". I figure this is more of a typo than a mistake though, since you did fine at the top.

Problem 2: You do not set "this.disabled" back to false after line 6. You're going to need to add another line of code to set this variable, which also means you're going to need brackets to support the new number of operations (more than one, which is currently only the function "enabledefmovement();")

Other than that, it seems fine. You might also want to replace the animation "push" with "walk" so that you don't start pushing the wall as you run.

Pelikano 11-18-2008 06:43 PM

Thanks for all your help guys!
It works fine now.. I've also added some stuff :D

NPC Code:
//#CLIENTSIDE
function onCreated() {
this.speed = 1;
this.disabled = true;
}

function onWeaponFired() {
if (this.disabled)
player.chat = "Boots on!";
this.speed = 1;
this.disabled = false;
setTimer(0.05);
}

function onTimeout() {
if (!this.disabled) {
for (i = 0; i < 4; i++) {
if (keydown(i)) {
player.dir = i;
player.x += vecx(player.dir)*this.speed;
player.y += vecy(player.dir)*this.speed;
}
setTimer(0.05);
}
}
}
function onKeyPressed(code, key) {
if (key == "f" && player.weapon.name == "Personal/Pelikano/Wall") {
this.disabled = true;
player.chat = "Boots off!";
}
if (key == "1" && player.weapon.name == "Personal/Pelikano/Wall" && this.disabled == false) {
this.speed = 1;
player.chat = "Speed 1!";
}
if (key == "2" && player.weapon.name == "Personal/Pelikano/Wall" && this.disabled == false) {
this.speed = 2;
player.chat = "Speed 2!";
}
if (key == "3" && player.weapon.name == "Personal/Pelikano/Wall" && this.disabled == false) {
this.speed = 2;
player.chat = "Speed 3!";
}
}



As I said above it works fine, thanks :D

Deas_Voice 11-18-2008 06:45 PM

for future notice pelikano, use PHP tags :)


All times are GMT +2. The time now is 08:01 PM.

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2026, vBulletin Solutions Inc.
Copyright (C) 1998-2019 Toonslab All Rights Reserved.