ID:167711
 
obj/Uzi
icon = 'Guns.dmi'
icon_state = "Uzi"
Pickup = 1
weapon = 1
ammo = 30
maxammo = 30
value = 300

obj/USSCOM
icon = 'Guns.dmi'
icon_state = "USSCOM"
Pickup = 1
weapon = 1
ammo = 15
maxammo = 15
value = 100

obj/Armour
icon = 'Guns.dmi'
icon_state = "Armour"
Pickup = 1
defence = 1
defencevalue = 5
value = 500
//Not all objects are in.
mob/verb/Buy()
var/obj/weapon = input ("What item do you want?") in list ("Medi Kit","Clip","USSCOM","Uzi","RPG","None")
if (weapon == "None")
return
else
var/really = input ("[weapon] costs [weaponvalue], are you sure?") in list ("Yes","No")
if (really == "Yes")
if (usr.cash >= weaponvalue)
usr.cash -= weaponvalue
new weapon(usr)
usr << "[weapon] brought for [weaponvalue]."
else
usr << "You can't afford [weapon]! You got [usr.cash]."


My problem is I need to call a Obj's value using Input (which is a different thing).

This is in How-To because I have no clue.

Please use weaponvalue as a Var, if used.

EDIT: I managed it! Haha...
i'm not sure but i think you use input like this.
var
weapon.value

switch(input("put what you want here[weapon.value]....") in list("Yes","No"))
if("No')
return
if("Yes")
put buying and all here.
In response to Dragon_fire6653
That's more of something you would use alert() for.
In response to Jp
Jp wrote:
That's more of something you would use alert() for.


I know, but I don't know how I can use the "buttons" it creates after 2 lines.

I'll test it out.


Code failed =

Shooter.dm:462:value :warning: variable defined but not used

And it did not work while running either.

runtime error: Cannot read "Uzi".value
proc name: Buy (/mob/verb/Buy)
usr: RedlineM203 (/mob/Player)
src: RedlineM203 (/mob/Player)
call stack:
RedlineM203 (/mob/Player): Buy()

mob/verb/Buy()
var/obj/weapon = input ("What item do you want?") in list ("Medi Kit","Clip","USSCOM","Uzi","RPG","None")
if (weapon == "None")
return
else
var/weapon.value
switch(input("[weapon] costs [weapon.value], are you sure you want it?") in list("Yes","No"))
if("Yes")
if (weapon.value <= usr.cash)
new weapon
usr.cash -= weapon.value
usr << "You buy the [weapon]."
else
usr << "Not enough cash! You have [usr.cash]."
Gonna bump, this is really important to me...