ID:150227
 
Ok my code works fine up to this point:

stats.Add(stat1,stat2,stat3,stat4,stat5,stat6)
var/list/modifiers
for(var/I in stats)
var/tmp/p = round((I-10)/2)
modifiers.Add(p)

Since I added the above code, I get an error about 20 lines up that worked just fine when I was just displaying stat1-6 (before I added them to the list).
Evilkevkev wrote:
Ok my code works fine up to this point:

stats.Add(stat1,stat2,stat3,stat4,stat5,stat6)
var/list/modifiers
for(var/I in stats)
var/tmp/p = round((I-10)/2)
modifiers.Add(p)

Since I added the above code, I get an error about 20 lines up that worked just fine when I was just displaying stat1-6 (before I added them to the list).

What is the error??? why dont you do stats=(stat1+stat2+ect...)

In response to Air _King
I want to do each stat separately, not all at once. (It's to figure out the modifiers for the stats, like in D&D)

[EDIT]
runtime error: Cannot execute null.Add().
proc name: Roll Stats (/mob/character/proc/Roll_Stats)
source file: Character Handling.dm,80
usr: Evilkevkev (/mob/character)
src: Evilkevkev (/mob/character)
call stack:
Evilkevkev (/mob/character): Roll Stats()
Evilkevkev (/mob/character): Login()
In response to Evilkevkev
Evilkevkev wrote:
I want to do each stat separately, not all at once. (It's to figure out the modifiers for the stats, like in D&D)

Oh I was making a D&D game...but oh well you can make it I sorta quit anyway. What are the errors?
In response to Air _King
runtime error: Cannot execute null.Add().
proc name: Roll Stats (/mob/character/proc/Roll_Stats)
source file: Character Handling.dm,80
usr: Evilkevkev (/mob/character)
src: Evilkevkev (/mob/character)
call stack:
Evilkevkev (/mob/character): Roll Stats()
Evilkevkev (/mob/character): Login()
In response to Evilkevkev
Evilkevkev wrote:
runtime error: Cannot execute null.Add().
proc name: Roll Stats (/mob/character/proc/Roll_Stats)
source file: Character Handling.dm,80
usr: Evilkevkev (/mob/character)
src: Evilkevkev (/mob/character)
call stack:
Evilkevkev (/mob/character): Roll Stats()
Evilkevkev (/mob/character): Login()

Oh get this in dream seeker. Um lookslike your stat thing equals zero thats the problem and

Add
One or more items to add to the list.
Appends the specified items to the list. If an argument is itself a list, each item in the list will be added.

is basicly the same thing as +
In response to Air _King
I was able to condense the code... I think for rolling stats and adding it to a list, but I get an error (in DS).

for(var/i=1,i<7,i++)
r1 = rand(1,6)
r2 = rand(1,6)
r3 = rand(1,6)
r4 = rand(1,6)
stats[i] += (r1+r2+r3+r4)-min(r1,r2,r3,r4)
//i get the error here where there is no code.

runtime error: cannot read from list
proc name: Roll Stats (/mob/character/proc/Roll_Stats)
source file: Character Handling.dm,59
usr: Evilkevkev (/mob/character)
src: Evilkevkev (/mob/character)
call stack:
Evilkevkev (/mob/character): Roll Stats()
Evilkevkev (/mob/character): Login()
In response to Evilkevkev
I figured out what the problem was.

When I was creating the list (var/list/stats) I wasn't setting a number of variables for the list to have. So when I tried to add a stat into a place in the list, it was like trying to put an elephant through a pinky ring that doesn't exist, it just won't happen.

To fix it, when creating the list, a given number of variables has to be set like this: var/list/stats[6]
In response to Evilkevkev
that what hte problem looks like