var/list/science = new/list("Blueprint","Fuel","Shovel","Spacepod","Spaceship")
mob
var
Intelligence // Intelligence Mod, effects how fast one gains knowledge.
Knowledge // Knowledge
obj
Items
Grab
verb
Get()
set category = null
set src in oview(1)
if(usr)
if(!usr.KO)
Move(usr)
viewers() << output("<font color=gray>[name] grabs [src].","output1")
Drop()
set category = null
set src in usr
loc = loc
step(src, dir)
viewers() << output("<font color=gray>[name] drops [src].","output1")
Minerals // Players will not use a built-in currency, but can create their own with materials given to them, or create in-game trading systems.
Copper
Gold
Iron
Mythril // used for fuel, mainly.
Stone
Wood
Science
var
coppercost
goldcost
ironcost
mythrilcost
stonecost
woodcost
quality // quality of the object. 1% to 100%.
Click(obj/O)
if(O in science)
for(var/obj/Items/Grab/Minerals/Copper/A in usr.contents)
if(A < coppercost)
return
for(var/obj/Items/Grab/Minerals/Gold/A in usr.contents)
if(A < goldcost)
return
for(var/obj/Items/Grab/Minerals/Iron/A in usr.contents)
if(A < ironcost)
return
for(var/obj/Items/Grab/Minerals/Mythril/A in usr.contents)
if(A < mythrilcost)
return
for(var/obj/Items/Grab/Minerals/Stone/A in usr.contents)
if(A < stonecost)
return
for(var/obj/Items/Grab/Minerals/Wood/A in usr.contents)
if(A < woodcost)
return
O = new(src.loc)
Blueprint
Fuel
coppercost = 0
goldcost = 0
ironcost = 0
mythrilcost = 100
stonecost = 0
woodcost = 0 // 1 litre of fuel is 100 mythril; 1 litre of fuel 100% quality fuel is enough to get halfway from Earth to the closest planets.
Shovel
coppercost = 0
goldcost = 0
ironcost = 0
mythrilcost = 0
stonecost = 50
woodcost = 15
Spacepod
coppercost = 550
goldcost = 250
ironcost = 375
mythrilcost = 250
stonecost = 0
woodcost = 0
Spaceship
coppercost = 2500
goldcost = 1500
ironcost = 2000
mythrilcost = 1500
stonecost = 0
woodcost = 0
Problem description:
All code listed up above, I am mainly curious about the Click procedure I have, using a bunch of for statements. Is there any way I can do this differently, and have I messed up with the current method?
EDIT: Also looks like you're comparing an object and a number. Huge runtime error going to pop up.