Welcome to the Builder Academy

Question What am i missing ?

More
25 Dec 2016 13:08 - 25 Dec 2016 13:20 #6463 by JTP
Replied by JTP on topic What am i missing ?
That worked, thanks.

A final thing, before this is top dollar. I would like race giant to have used 3:
Code:
if (GET_RACE(ch) == RACE_GIANT) { int used = 3; } else { int used = 2; } But then i get error, and suddently used is unused, and further Down undeclared: act.item.c: In function ‘free_hands’: act.item.c:53: warning: unused variable ‘used’ act.item.c:55: warning: unused variable ‘used’ act.item.c:57: error: ‘used’ undeclared (first use in this function) act.item.c:57: error: (Each undeclared identifier is reported only once act.item.c:57: error: for each function it appears in.) make[1]: *** [act.item.o] Error 1

Merry Christmas to all
Last edit: 25 Dec 2016 13:20 by JTP.

Please Log in or Create an account to join the conversation.

More
25 Dec 2016 15:03 #6464 by thomas
Replied by thomas on topic What am i missing ?
Code:
int used = 2; if (GET_RACE(ch) == RACE_GIANT) { used = 3; }
You need to have the "int" part in the same {}-part it is used, or further out. If you put it inside the if's the variable will be unknown outside the if's.

Please Log in or Create an account to join the conversation.

Time to create page: 0.167 seconds