ID:261980
 
I've tried to make a mob that gives you the oppertunity to customise the colour of the item you buy from him. So far i have this:

mob
shop
Dave
icon='mob.dmi'
icon_state="dave"
verb
Talk()
set src in oview(1)
switch(alert("Hello! Would you like to buy a Tunic?","Dave","Yes","No"))
if("Yes")
if(usr.gold <= 2499)
usr << "<b>You need 2500 gold!"
if(usr.gold >= 2500)
usr.gold -= 2500
var/new_rgb = F_Color_Selector.Get_Color(src)
var/tunic/I = new('tunic.dmi')
I.Blend(new_rgb)
tunic = I
usr.contents += new /obj/tunic
usr << "<b>You get a Tunic!"

if("No")
return

obj
tunic
icon='tunic.dmi'
name="[usr]'s Tunic"
verb
Wear()
set category = "Inventory"
if(src.worn == 1)
src.worn = 0
usr.overlays -= 'tunic.dmi'
usr << "You remove the [src.name]."
else
src.worn = 1
usr.overlays += 'tunic.dmi'
usr << "You wear the [src.name]."



Obviously, i have the "f_color_code.dm" incoperated into my '.dme' file
I'm new at addapting libraries into my own game.
So, if someone can help me change it, i will be eternally greatful.
So... uh, what's actually the problem? =)

The correct way to include libraries is to tick the checkbox next to their names in the File pane on the left of Dream Maker. If you can't see it, make sure that you've expanded the "Lib" section (click the plus sign next to "Lib" in the File pane; it works like the folder view of Windows Explorer).

If you're copying and pasting library code, then that's bad (unless you really, really know what you're doing).
In response to Crispy
Don't worry, thats not what i've done. I have ticked the box :D

Anyway, it comes up with 'I.Blend' not being a valid proc.

I don't see whats wrong, i mean i managed to get s_damage working (i know this has nothing to do with my current problem).

Is that any help?
Evil Guy wrote:
var/tunic/I = new('tunic.dmi')

This is your problem, you're trying to define a datum, but Blend() in an icon proc. So, simply change it to,

var/icon/I = new('tunic.dmi')
In response to Goku72
Yeh, ok. Now i have this for the mob
mob
shop
Dave
icon='mob.dmi'
icon_state="dave"
verb
Talk()
set src in oview(1)
var/new_rgb = F_Color_Selector.Get_Color(src)
var/icon/I = new('tunic.dmi')
I.Blend(new_rgb)
icon = I
usr << "<b>You get a Tunic!"
usr.contents += new I


It compiles with no errors but when i talk to "Dave" his icon changes to the tunic icon and the colour selector window doesn't come up. What i want is the Tunic to have my customised colour and it to be in my inventory.
In response to Evil Guy
Now after messing around a bit, i have this:

 mob
shop
Dave
icon='mob.dmi'
icon_state="dave"
verb
Talk()
set src in oview(1)
var/obj/tunic/S = new()
var/new_color = F_Color_Selector.Get_Color(usr)
var/icon/I = new(S.icon)
I.Blend(new_color, ICON_ADD)
S.icon = I
usr.contents += new S


This time, the color changer window does come up but the tunic does not appear in my inventory.
I'm must be getting close (with your help guys. Thanks a lot so far!!)
In response to Evil Guy
Evil Guy wrote:

usr.contents += new S
</dm>
This should be just 'usr.contents += S'. You already made a nice custom colored tunic for him, you don't want to make another.