ID:150844
 
I am making a game with several classes. I want each class to make the player recieve different stats depending on which you choose. This is my login dm:

mob/Login()
usr.name = input("What is your name?") as text
world << "[usr] has entered the world."
var/c = input("Choose a class.") in list("Warrior (Male)")
switch(c)
if("Warrior (Male)")
world << "[usr] has entered the world."
mob/player
icon = 'player.dmi'
icon_state = "1"
var
HP = 60
MP = 10
str = 5
def = 3
Level = 1
Exp = 0
NextLevel = 1000
GiveExp = 100
Kills = 0
Ali = "Good"
Move(locate(/area/start))

I get several warnings, one for each of my vars saying:

login.dm:12:HP :warning: variable defined but not used

but they are used but it won't recognize them, why?
When i didn't have classes it looked like this:

mob
player
icon = 'player.dmi'
icon_state = "1"
var
HP = 60
MP = 10
str = 5
def = 3
Level = 1
Exp = 0
NextLevel = 1000
GiveExp = 100
Kills = 0
Ali = "Good"

and it worked. but no classes. Is there a common medium? I've tried everything and i've examined vortezz's demo! I am really stumped. Any help would be appriciated! Thanks!



On 7/18/01 6:20 pm SSTrunks7 wrote:
and it worked. but no classes. Is there a common medium? I've tried everything and i've examined vortezz's demo! I am really stumped. Any help would be appriciated! Thanks!

You are trying to define classes inside of a proc, which you can't do.

You need to define the classes elsewhere and use them in the proc.

I know you may have looked at them, but look at the ZBT tutorial and the Step Beyond code again to see how classes are defined and accessed. Plus in an answer to another question (from you I think) today, someone explained this in detail.
On 7/18/01 6:20 pm SSTrunks7 wrote:
and it worked. but no classes. Is there a common medium? I've tried everything and i've examined vortezz's demo! I am really stumped. Any help would be appriciated! Thanks!

You are trying to define classes inside of a proc, which you can't do.

You need to define the classes elsewhere and use them in the proc.

I know you may have looked at them, but look at the ZBT tutorial and the Step Beyond code again to see how classes are defined and accessed. Plus in an answer to another question (from you I think) today, someone explained this in detail.
In response to Deadron
On 7/18/01 6:25 pm Deadron wrote:
On 7/18/01 6:20 pm SSTrunks7 wrote:
and it worked. but no classes. Is there a common medium? I've tried everything and i've examined vortezz's demo! I am really stumped. Any help would be appriciated! Thanks!

You are trying to define classes inside of a proc, which you can't do.

You need to define the classes elsewhere and use them in the proc.

I know you may have looked at them, but look at the ZBT tutorial and the Step Beyond code again to see how classes are defined and accessed. Plus in an answer to another question (from you I think) today, someone explained this in detail.

Thanks for trying to help Deadron and when i scan these boards i always see you helping others but your advice on this issue is not helping, i think for my last question you told me the same thing "look at the step tutorial" well, i have, in fact i've looked at it about a dozen times trying to compare. I just want to know what's wrong with my code. What proc could i use to fix it. This really isn't too much to ask for i hope. If it is then i'm sorry to inconvienience you. Bye.
In response to SSTrunks7
On 7/18/01 6:33 pm SSTrunks7 wrote:
Thanks for trying to help Deadron and when i scan these boards i always see you helping others but your advice on this issue is not helping, i think for my last question you told me the same thing "look at the step tutorial" well, i have, in fact i've looked at it about a dozen times trying to compare. I just want to know what's wrong with my code.

I'm telling you what's wrong with it: You can't define a class inside a proc, you define it elsewhere and then create an object of that type in a proc and access it.

A pretty clear example is here:

byond://Deadron.CharacterSaving

This shows how to define a class somewhere, then create a mob of that class and fill in its attributes in a proc.