ID:176096
 
I was wondering how do you use lists, coding etc.
How would i make a list where when you get an item it adds that to the list so when im in battle it would say i have it, because there can be multiple ones there cant be any given order. and i want a screen to pop up saying which item will you use or something like that with choices. the choices only appear if you have that item. and if you have non then it will say that you have none. something really simple and not so big, please help.
Cloudiroth wrote:
I was wondering how do you use lists, coding etc.
How would i make a list where when you get an item it adds that to the list so when im in battle it would say i have it, because there can be multiple ones there cant be any given order. and i want a screen to pop up saying which item will you use or something like that with choices. the choices only appear if you have that item. and if you have non then it will say that you have none. something really simple and not so big, please help.

Here is a very vague example.. I'm trying not to give newcommers code straight out, so they learn themselves. Aside from reading this example, look up lists in the reference. (Press F1 in dreammaker)
obj
verb/Get()
set src in oview(1) // Give you the verb if you are one tile away
usr.inventory += src // Add the object to the inventory list.
proc/Use() // Creates the initial proc of "use".
Test_Object
Use(mob/M as mob)
M << "You feel strange.."
Test_Potion
Use(mob/M as mob)
// M.hp += 10
M << "You feel much better, now."
mob/var/list/inventory = new() // Create a new list that resides inside of all mobs.
mob/verb/Use()
var/obj/O = input("What would you like to use?") in usr.inventory // Define an object as whatever he/she picks from their inventory list
O.Use(usr)


~>Volte