Tuesday 6 June 2017

Roll not defined - Reference Error

I recently installed a node.js package called roll for my text based game that I am making. Here is my code: var totalHealth = 100

 var swordAttack = roll.roll(d100);

console.log(swordAttack.result); if (swordAttack.result >=50 ) { totalHealth = totalHealth * 0.15 };

console.log(); {
    return swordAttack
};`

Now I realise the syntax looks a bit funny, this is my first post and honestly i'm not amazing at coding but i'm learning. The idea of this code is to roll a number 1-100 if it is more than or equal to 50 it will deal 15 damage if not it will miss. So the error i'm getting is coming through the console when I run the code: enter image description here

I am using VS code if that helps, if you need anymore info i'm happy to reply.



via Goste2

No comments:

Post a Comment