mob
verb
Save()
var/savefile/Objects=new/savefile("objs.sav")
var/Num=0
for(var/obj/O in world.contents)
Objects["Object[++Num]"]<<O
Objects["Num"]<<Num
world<<"[Num] Object\s saved successfully!"
Load()
var/savefile/Objects=new/savefile("objs.sav")
var/Num=0
Objects["Num"]>>Num
if(Num)
for(var/i=1 to Num)
var/obj/newobj
Objects["Object[i]"]>>newobj
world<<"[Num] Objects\s loaded successfully!"
turf/house
mobcheck
icon = 'things2.dmi'
icon_state = "Tile"
verb/own()
set src in view(1)
set category = "Communication"
src.owner = usr
if(usr.gold <= 2999)
usr << "You need 3000 gold!"
usr.house = 0
if(usr.gold >= 3000)
usr << "You have bought the house!"
usr.gold -= 3000
usr.owner = usr.key
usr.house = 1
Enter(mob/M)
if(ismob(M))
if(M.client)
if(src.owner == M)
return ..()
else
M <<"This is not your room."
everything works except that when the house is owned it can be bought again-_- and I want to know if anyone here will let me have some coding and info for things like house message/house sell and um that when they walk up and touch the thing it does an alert message instead of them having to press own button and also, If I use this same thing in 2 different houses will 2 different people be able to buy the 2 different houses?</<num></<o>
ID:261909
Jan 7 2004, 2:53 am
|
|
You need to make a check when someone activates the buy verb to see if the house is already owned, such as:
if(src.owned==null) then have it execute the rest of the code as if it wasnt owned. Then make an else clause that pops up your alert message if it is. be sure to set the owned to true when they buy the house if it isnt already owned. example: if(src.owned==null) put the relator to work in here! else tell them to get off the property before you send spike |
I'm not sure why you're using double tabs, but the forum converting each tab to 8 spaces is already bad enough. Think you could lose a few of those the next time you post? The extra tabbing makes it awfully hard to read.
Lummox JR |
In response to CableMonkey
|
|
That's saying 'make sure that src is in the list 'view(1)' before you let it use the verb'. There are others, like 'set src in usr.contents' which is saying 'make sure that src is in usr's contents list before letting it use the verb'.
|
In response to Hazman
|
|
Hmm...I understand the purpose and how it works now, but to me...looking at it from the readability context...its confusing.
|
<code>set src in view(1)</code>
From my programming experience in other languages, you should never have to set the source variable.
Anyway...isn't src just a single variable and not a list? I want to say that the "in" operator results in a list.
Just some ideas until someone who knows what they are talking about shows up.