Function def error?


#1

So I am trying to define a function and it’s tell me that it is not a function why is it doing this?
code

this.commadToops = function(){
};

this.summonTroops = function() {
};

this.collectCoins = function() {
};

loop{
    this.collectCoins();    
    this.summonTroops();
    this.commandTroops();
}






#2

I would guess you mean that the function CALL (where you try to use it) is telling you it is not a function, please be more specific in the future. :smile:

this.commadToops = function(){
[...]
this.commandTroops();

you named the function: commadToops (no ‘n’ or ‘r’)
you call a function named: commandTroops (with ‘n’ and ‘r’)


#3
    cost = this.costOf(type);
    if(cost >= this.gold)

#5

if cost is greater than gold…
…bug the poor sales clerk?, until he gets his manager to call the cops…
…go window shopping?, since you can’t afford it…


#6

ah thanks @Vlevo

Window shopping?


#7

Guys, phft :wink: . . . Imagine walking down the street (mall concourse) and looking at the displays in the shop windows…

“Window shopping” is where you go drool over all the stuff. (All drooling, no buying.)


#8

Ah thank you for explaing