ID:171999
 
What is the code to move an object to the users inventory. I stopped coding for a couple months and now I'm starting again and I've forgotten the most BASIC stuff. =D
Newbreedofnerd wrote:
What is the code to move an object to the users inventory. I stopped coding for a couple months and now I'm starting again and I've forgotten the most BASIC stuff. =D

Key [Male] Newbreedofnerd
Forged 6/29/04

Dont lie about coding for months when your key was forged about 1-2 weeks ago , no one cares if your a newbie that needs help, after all thats what these forums are for :)
In response to XzDoG
My old key was Coolchris. check that one. I got a new computer and deleted all the BYOND stuff and thats why i cant check my old games to see how.


btw: can you plz just answer my question?
In response to Newbreedofnerd
Newbreedofnerd wrote:
My old key was Coolchris. check that one. I got a new computer and deleted all the BYOND stuff and thats why i cant check my old games to see how.


btw: can you plz just answer my question?


http://developer.byond.com/hub/Search
In response to XzDoG
... ... ...

I wish I could say thanks...
In response to Newbreedofnerd
Well one way of doing it is if you store objects in the variable contents then this:

obj
sword
icon = 'sword.dmi'

mob
SwordMaster
verb
Talk()
set src in oview(2)
set category = "Stuff"
usr << "You get a new sword"
usr.contents += new /obj/sword // this is the bit that adds the sword to the variable.


In response to DeathAwaitsU
DeathAwaitsU wrote:
Well one way of doing it is if you store objects in the variable contents then this:

> obj
> sword
> icon = 'sword.dmi'
>
> mob
> SwordMaster
> verb
> Talk()
> set src in oview(2)
> set category = "Stuff"
> usr << "You get a new sword"
> usr.contents += new /obj/sword // this is the bit that adds the sword to the variable.
>
>


That's choppy, and it's incorrect. If he wanted to know how to just add to a list, that's different, and the example you showed is crap. It doesn't even have sub types for different object types. It's better to use the default enter() and exit() and associated procs to do inventory handling.

http://developer.byond.com/hub/Goku72/ EquipmentInventory_System
In response to Teh Governator
There's no reason to use his method. Mine works fine, why use so many proccesses and such a long code?
Jeeze
obj
monkey
verb
get()
set category = "Monkeying Around"
usr << "You pick up the monkey."
Move(usr)
In response to DeathAwaitsU
DeathAwaitsU wrote:
There's no reason to use his method. Mine works fine, why use so many proccesses and such a long code?

Just because, it's shorter doesn't mean it's the better solution. Doing everything the way that's shown in that demo is the correct way to move anything into the mob. And, it's much easier to track down possible errors, bugs, etc...if any occur, and, in the long run it's shorter than copy+pasting the same redundant code over and over again for each new item you wish to add to the inventory. Which leads me to my next point...don't make redundant code. Why post the same thing 50+ times over and over again, then notice you made a mistake...so, you have to then go back and correct each instance, instead of just that one "long" piece of code.
In response to Teh Governator
Well you're also going to be copying and pasting that code a million times as well arent you?
In response to DeathAwaitsU
DeathAwaitsU wrote:
Well you're also going to be copying and pasting that code a million times as well arent you?


No.