Here is the Cooking verb from the Campfire obj.
obj/items/campfire
icon='build7.dmi'
icon_state="82"
name="Camp fire"
New()
spawn(600)
del(src)
var
beingcooked=0
verb
Put_Out()
set src in oview(1)
set category = "Skills"
if(!src.beingcooked)
view(usr)<<output("A campfire was put out.","rpoutput")
del(src)
else
usr<<"The fire is cooking something."
return
verb
Cook()
set src in oview(1)
set category = "Skills"
if(!usr.cooking)
for(var/obj/items/Food/Cookable/F in usr.contents)
var/list/Options=list()
Options["[F.name] - x[F.Amount]"]=F
var/Choice = usr.CustomInput("Cook","What would you like to cook?",Options + "Cancel")
if(Choice:name=="Cancel")
return
if(typesof(Choice,/obj/items/Food/Cookable/))
usr.cooking=1
view(usr)<<output("[usr] is cooking a [F]","rpoutput")
src.beingcooked=1
usr<<"test" // after this line is where the verb suddenly stops working.
usr.cookselection+=F
usr<<"testfinish"
Cookup(F) // see next code for this one <-- It's my cook proc to apparently cook the object you selected from your inventory via CustomInput() above.
sleep(30)
//F.Amount-=1
usr.cooking=0
src.beingcooked=0
view(usr)<<output("[usr] has cooked a [F].","rpoutput")
usr.cookselection-=F
return
else
usr<<"You are already cooking."
Here is my cookup proc, which is supposed to cook the object you selected from the campfire Cook verb. It does work up into an extent, but the name changes does not work. I've tried using replacetext, but maybe I'm using it wrong.
obj/proc/Cookup(obj/items/Food/Cookable/O in usr.cookselection)
if(O.Amount==1)
usr<<"testedfirst"
var/obj/items/Food/Cookable/F = new
F.icon=O.icon
F.hungerpts=O.hungerpts
F.thirstpts=O.thirstpts
F.hungerr=O.hungerr
F.strbuff=O.strbuff
F.endbuff=O.endbuff
F.resbuff=O.resbuff
F.forcebuff=O.forcebuff
F.speedbuff=O.speedbuff
F.offbuff=O.offbuff
F.defbuff=O.defbuff
F.regenbuff=O.regenbuff
F.recovbuff=O.recovbuff
O.name = replacetext("[O.name]","Raw", "Cooked")
//F.name="Cooked [O.name]"
F.name=O.name
usr<<"another test"
if(F.strbuff>0.0001) //strcook
F.strbuff+=0.5
if(F.endbuff>0.0001)//endcook
F.endbuff+=0.5
if(F.forcebuff>0.0001)//force cook
F.forcebuff+=0.5
if(F.resbuff>0.0001)// res cook
F.resbuff+=0.5
if(F.speedbuff>0.0001) // spd cook
F.speedbuff+=0.5
if(F.offbuff>0.0001)
F.offbuff+=0.5
if(F.defbuff>0.0001)
F.defbuff+=0.5
if(F.regenbuff>0.0001)
F.regenbuff+=0.5
if(F.recovbuff>0.0001)
F.recovbuff+=0.5
var/icon/I=new(F.icon)
I.Blend(rgb(90,0,30),ICON_MULTIPLY)
usr<<"finaltest"
F.icon=I
//F.Amount=1
usr.itemAdd(F)
del(O)
if(O.Amount>1)
usr<<"testedsecond"
if(O.strbuff>0.0001) //strcook
O.strbuff+=0.5
if(O.endbuff>0.0001)//endcook
O.endbuff+=0.5
if(O.forcebuff>0.0001)//force cook
O.forcebuff+=0.5
if(O.resbuff>0.0001)// res cook
O.resbuff+=0.5
if(O.speedbuff>0.0001) // spd cook
O.speedbuff+=0.5
if(O.offbuff>0.0001)
O.offbuff+=0.5
if(O.defbuff>0.0001)
O.defbuff+=0.5
if(O.regenbuff>0.0001)
O.regenbuff+=0.5
if(O.recovbuff>0.0001)
O.recovbuff+=0.5
O.name="Cooked [O.name]"
var/icon/I=new(O.icon)
I.Blend(rgb(90,0,30),ICON_ADD)
O.icon=I
usr.itemAdd(O)
Problem description:
In the first code, it's supposed to just pop up a input box that allows you to select one of the foods in the usrs contents. But it only shows one type of the food, meaning it only gives one row. Maybe an error in my customInput() proc, but that's besides the point
The real issue is, that I cannot get the Cookup proc to register F as if it was the actual obj from the usr, basically it's suppose to just copy let's say a Raw Steak, adapt it's buffs, blend some color to make it look cooked, and change it's name. While also decreasing/deleting the Raw Steak amount prior. I'm probably make a few real clumsy noob mistakes but any advice can help.
Been at this for awhile and I really want to know how I can go about calling the actual object from one verb, into another proc.
Thank you
I did this recently because I had a code that worked prior just intsead Cookup()'s proc did not copy the obj's icon for a duplicate, instead just made an empty icon in inventory named: Cookable
But yeah, i'm all out of "do-it-yourself" time, lol.