Blockland Forums > Modification Help
Syntax Error in Script
<< < (3/4) > >>
Audax:
Oh I see. What would I add though to call the tumble function if the player's velocity is less than or equal to -20?
Headcrab Zombie:
if(getWord(%obj.getVelocity(),2) <= -20)
    tumble(%obj,2500);

Change %obj to whatever, of course.


Some people may find this script annoying though...
Audax:
Now there is a Syntax error in 'function tumble'


--- Code: ---Loading Add-On: Script_TumbleOnFall (CRC:1828132999)
Add-Ons/Script_TumbleOnFall/TumbleOnFall.cs Line: 13 - Syntax error.
>>> Some error context, with ## on sides of error halt:
ackage TumbleOnFall

{

^function Player::getVelocity(%this,%obj,%col,%pos,%speed)

^{

^%zVec = getWord(%obj.getVelocity(),2);

^if(%zVec <= -20)

^^{

^^if(getWord(%obj.getVelocity(),2) <= -20)

^^   tumble(%obj,2500);

^^}

^}

}

function ##t##umble(%obj, %time)

{

   //do not tumble non-players

   if(!(%obj.getType() & $TypeMasks::PlayerObjectType))

      return;



   //do not tumble dead people

   if(%obj.getDamageLevel() >= 1.0)

      return;



^//mount the object on a new deathvehicle for %time milliseconds
>>> Error report complete.

ADD-ON "Script_TumbleOnFall" CONTAINS SYNTAX ERRORS
--- End code ---

Are there other parts of the deathVehicle code I need in the script?
Pew446:

--- Quote from: Audax on June 12, 2010, 05:25:22 PM ---Now there is a Syntax error in 'function tumble'

Loading Add-On: Script_TumbleOnFall (CRC:1828132999)
Add-Ons/Script_TumbleOnFall/TumbleOnFall.cs Line: 13 - Syntax error.
>>> Some error context, with ## on sides of error halt:
ackage TumbleOnFall

{

^function Player::getVelocity(%this,%obj,%col,%pos,%speed)

^{

^%zVec = getWord(%obj.getVelocity(),2);

^if(%zVec <= -20)

^^{

^^if(getWord(%obj.getVelocity(),2) <= -20)
^^{
^^   tumble(%obj,2500);
^^}
^^}

^}

}

function ##t##umble(%obj, %time)

{

   //do not tumble non-players

   if(!(%obj.getType() & $TypeMasks::PlayerObjectType))
{
      return;
}


   //do not tumble dead people

   if(%obj.getDamageLevel() >= 1.0)
{
      return;
}


^//mount the object on a new deathvehicle for %time milliseconds
>>> Error report complete.

ADD-ON "Script_TumbleOnFall" CONTAINS SYNTAX ERRORS

Are there other parts of the deathVehicle code I need in the script?

--- End quote ---
Kalphiter:
1. Pew is stupid, ignore him
2. there are two checks to see if the z velocity is less than -20
3. Player::getVelocity should be Player::onCollision, and should be parented
     Player::getVelocity makes no sense, it's not an event and is only called when other add-ons need to get the velocity.
4. tumble isn't closed? That might just be the snip of the whole code.
Navigation
Message Index
Next page
Previous page

Go to full version