ID:148891
 
Well im tringto make a trade verb but I keep gettin these odd errors.

mob
verb
Trade()
set category = null
for(var/mob/M in get_step(usr,usr.dir))

if(M.key && M.client)
if(inTrade == 0)
if(usr.client.address != "")
var/Tradeq = input(M,"Wanna Trade?") in list("No","Yes")
if(inTrade == 0)
switch(Tradeq)
if("Yes")
usr << "In Yes"
usr.inTrade = 1
M.inTrade = 1
Tradee(usr,M)
..()
if("No")
usr << "[M.name] declines."
..()
else
usr << "This person is already in a Trade."
else
usr << "You can't Trade yourself"
else
usr << "This person is already in a Trade."
else
usr << "You can't Trade with an NPC."

mob
proc
Tradee(mob/player1 as mob, mob/player2 as mob)

var/O = input(player1, "What do you wish to trade?") in usr.contents

var/B = input(player2, "What do you wish to trade?") in usr.contents
player1.contents+=B
player1.contents-=O
player2.contents+=O
players2.contents-=B
------------
heres the errors
------
Ninja Warriors.dm:173:error:players2.contents:undefined var
Ninja Warriors.dm:170:error:B: compile failed (possible infinite cross-reference loop)
Ninja Warriors.dm:173:error:B: compile failed (possible infinite cross-reference loop)
------
Just want to know if theres a way to fix that are a way to do it better.
Vortezz has a bartending demo that does exactly what you want...
In response to Sariat
Sorry Sariat im not going to pay 3 dimes for somthing that I can kindly ask some one for -_-.
Try changin mob/player1 and mob/player2 to var/mob/player1 and var/mob/player2. That should fix the undefined var error, but I'm not sure about the other two.
Rollerc wrote:
mob
proc
Tradee(mob/player1 as mob, mob/player2 as mob)

var/atom/O = input(player1, "What do you wish to trade?") in player1.contents

var/atom/B = input(player2, "What do you wish to trade?") in player2.contents
player1.contents+=B
player1.contents-=O
player2.contents+=O
player2.contents-=B
------------

I also changed the contents lists that you were referring to. The way your code was, it would choose objects only from the mob that called the verb.
In response to Rollerc
We'll see.