Subtracting with associative lists in Developer Help
|
|
Code:
var/testlist=list() mob/verb/test_addmob(mob/M in world) set category="TEST" testlist[M]=60
mob/verb/test_editlist() set category="TEST" for(var/mob/m in world) if(testlist[m]>0)world<<"[testlist[m]]" testlist+=40 for(var/mob/M in world) if(testlist[M]>0) world<<"[testlist[M]]"
|
Problem description:
testlist can have any length, and each one == a number
I want to be able to change everysingle one of thos values...
in terms of the above snippet: I want the first number outputted to be "60" and I want the 2nd number outputted to be "100" (since 60+40=100)
|
What you need to do is indent your testlist+=40 line and change it to testlist[m]+=40 instead. That will add 40 to the associated value for each m.
Lummox JR