mob
verb/Give(mob/M in oview(1))
switch(input("What would you like to give [M]?")in list ("Gold","Items","Nevermind"))
if("Gold")
var/G = input("How much gold would you like to give [M]?",1,usr.gold)
switch(input("Are you sure you want to give [G] gold to [M]?")in list ("Yes","No"))
if("Yes")
M.gold += G
usr.gold -= G
M << "[usr] gives you [G] gold."
else
return
if("Item")
var/obj/I = input("What item would you like to give to [M]?",usr.contents)
switch(input("Are you sure you want to give this to [M]?")in list ("Yes","No"))
if("Yes")
M.contents += I
M << "[usr] gives you a [I]."
else
return
else
return
Problem description:
It would be very helpful since I have been thinking of another way how to do this for about 2 weeks. This code doesn't rise any errors, it just doesn't work while running the game. Just to tell you this game is a Live! game and I have tested Giving items to other players. It doesn't work.
input([user,]text[,title,default]) [as specifier] [in container]
text: the only required field will display a message in the window.
optional arguments:
user: will display the message to a specific user. This defaults to usr. Usr is generally the client/mob that made an action last.
title: the title of the popup window.
default: what value will be highlighted when the window is created.
Specifier:
The specifier can be multiple things, a generic type (obj, mob, turf, area, etc.), or a type of data (text, num, anything, or null)
If you use anything, it must always come after every other specifier.
If you use null, you will have a cancel button in the window.
Multiple specifiers can be combined by using a binary or (|) between each specifier.
Container:
This is specifically for selecting things out of lists. Do not use the 'in' keyword if you are wanting a string entry, or a number entry.
Second, didn't include any error handling. If you gave someone an item, and then didn't click "yes", and then you successfully gave the same item to another player, you could swindle the item out of one player's inventory into another's. I just added a simple trap to keep that from happening.