Thanks Kea Shotgun Shell for this code, but, one small problem, u forgot to define src.owner which i'm afraid im a little rusty at:
//Here you go, I know i had been looking for this for a LONG while. So when i found it i figured
//i would give it out for free to all up and coming coders.
//*Enjoy* - Chase_Hammer
mob/var
canenter
turf/Chibi
Entered(O)
if(usr.key == "Chibi_Gohan123") //Your Key of Choice.
usr<<"You enter house.."
step(usr.dir,1)
else
usr<<"This is not your house!"
step_away(usr,1)
area
House1
Enter()
if(owned==1)
if(usr.owner=="House1")
usr<<"Welcome"
usr<<"[housename]"
return 1
else
if(usr.canenter=="House1")
usr<<"[housename]"
return 1
else
usr<<"This is not your house,[housename]"
return 0
else
switch(alert("This house is for sale, do you want to buy it for 50000 gold?",,"Yes","No"))
if("Yes")
if(usr.money>=50000) //How ever much you want the tempary house to sell for.
usr.money-=50000 //How ever much you want the tempary house to sell for.
usr.owner="House1"
owned=1
statpanel("House")
usr.verbs+=/mob/proc/invite
usr.verbs+=/mob/proc/un_invite
usr.verbs+=/mob/proc/name_house
else
usr<<"You dont have enough gold!"
if("No")
return 0
House2
Enter()
if(owned==1)
if(usr.owner=="House2")
usr<<"Welcome"
usr<<"[housename]"
return 1
else
if(usr.canenter=="House2")
usr<<"[housename]"
return 1
else
usr<<"This is not your house,[housename]"
return 0
else
switch(alert("This house is for sale, do you want to buy it for 50000 gold?",,"Yes","No"))
if("Yes")
if(usr.money>=50000) //How ever much you want the tempary house to sell for.
usr.money-=50000 //How ever much you want the tempary house to sell for.
usr.owner="House2"
owned=1
statpanel("House")
usr.verbs+=/mob/proc/invite
usr.verbs+=/mob/proc/un_invite
usr.verbs+=/mob/proc/name_house
else
usr<<"You dont have enough gold!"
if("No")
return 0
area
House3
Enter()
if(owned==1)
if(usr.owner=="House3")
usr<<"Welcome"
usr<<"[housename]"
return 1
else
if(usr.canenter=="House3")
usr<<"[housename]"
return 1
else
usr<<"This is not your house,[housename]"
return 0
else
switch(alert("This house is for sale, do you want to buy it for 50000 gold?",,"Yes","No"))
if("Yes")
if(usr.money>=50000) //How ever much you want the tempary house to sell for.
usr.money-=50000 //How ever much you want the tempary house to sell for.
usr.owner="House3"
owned=1
statpanel("House")
usr.verbs+=/mob/proc/invite
usr.verbs+=/mob/proc/un_invite
usr.verbs+=/mob/proc/name_house
else
usr<<"You dont have enough gold!"
if("No")
return 0
area
House1
var
owned
housename
House2
var
owned
housename
House3
var
owned
housename
mob
proc
invite(mob/M in world)
set category="House"
if(M.client==null)
src<<"You can't invite non-player characters into houses!"
else
M.canenter=src.owner
M<<"You have been invited into [src]'s home"
src<<"you have invited [M] into your home"
name_house()
set category="House"
if(src.owner=="House1")
for(var/area/House1/H in world)
H.housename=input("What do you want to name your house?")
if(src.owner=="House2")
for(var/area/House2/H in world)
H.housename=input("What do you want to name your house?")
if(src.owner=="House3")
for(var/area/House3/H in world)
H.housename=input("What do you want to name your house?")
un_invite(mob/M in world)
set category="House"
if(M.client==null)
src<<"You can't un invite non-player characters into houses!"
else
M.canenter=0
M<<"You have been un invited to [src]'s home"
src<<"you have un invited [M] into your home"
i get the following errors, i know how to define the money so don't worry about the money errors:
loading The Legend Of The Man.dme
house code.dm:22:error:usr.owner:undefined var
house code.dm:36:error:usr.money:undefined var
house code.dm:37:error:usr.money:undefined var
house code.dm:38:error:usr.owner:undefined var
house code.dm:53:error:usr.owner:undefined var
house code.dm:67:error:usr.money:undefined var
house code.dm:68:error:usr.money:undefined var
house code.dm:69:error:usr.owner:undefined var
house code.dm:85:error:usr.owner:undefined var
house code.dm:99:error:usr.money:undefined var
house code.dm:100:error:usr.money:undefined var
house code.dm:101:error:usr.owner:undefined var
house code.dm:134:error:src.owner:undefined var
house code.dm:139:error:src.owner:undefined var
house code.dm:142:error:src.owner:undefined var
house code.dm:145:error:src.owner:undefined var
The Legend Of The Man.dmb - 16 errors, 0 warnings (double-click on an error to jump to it)
(i hope the Headmistress doesn't respond...(she's not very nice))
ID:262036
Jun 30 2004, 1:11 pm
|
|
Ok well i think i see the problem, im not sure though. First off, your trying to define usr.owned. If you want it to work right, try using somethin like this:
area House1 Entered(mob/M) for(var/area/House1/H) if(H.owned==1) if(H.owner=="[M.key]") M<<"Welcome" M<<"[housename]" else if(M.canenter=="House1") usr<<"[housename]" else usr<<"This is not your house,[M.name]" else switch(alert("This house is for sale, do you want to buy it for 50000 gold?",,"Yes","No")) if("Yes") if(usr.money>=50000) //How ever much you want the tempary house to sell for. usr.money-=50000 //How ever much you want the tempary house to sell for. H.owner="[M.key]" owned=1 usr.verbs+=/mob/proc/invite usr.verbs+=/mob/proc/un_invite usr.verbs+=/mob/proc/name_house else usr<<"You dont have enough gold!" if("No") return 0 Finally, add this: turf/Chibi Entered(mob/M) if(M.key == "Chibi_Gohan123") //Your Key of Choice. usr<<"You enter house.." step(usr.dir,1) else usr<<"This is not your house!" step_away(usr,1) mob/var/gold = 0 |
In response to Reinhartstar
|
|
Reinhartstar wrote:
Ok well i think i see the problem, im not sure though. First off, your trying to define usr.owned. If you want it to work right, try using somethin like this: ok, now i have this: mob/var canenter turf/Chibi Entered(mob/M) if(M.key == "Chibi_Gohan123") //Your Key of Choice. usr<<"You enter house.." step(usr.dir,1) else usr<<"This is not your house!" step_away(usr,1) mob/var/money = 0 mob/var/owner = 0 area House1 Entered(mob/M) for(var/area/House1/H) if(H.owned==1) if(H.owner=="[M.key]") M<<"Welcome" M<<"[housename]" else if(M.canenter=="House1") usr<<"[housename]" else usr<<"This is not your house,[M.name]" else switch(alert("This house is for sale, do you want to buy it for 50000 gold?",,"Yes","No")) if("Yes") if(usr.money>=50000) //How ever much you want the tempary house to sell for. usr.money-=50000 //How ever much you want the tempary house to sell for. H.owner="[M.key]" owned=1 usr.verbs+=/mob/proc/invite usr.verbs+=/mob/proc/un_invite usr.verbs+=/mob/proc/name_house else usr<<"You dont have enough gold!" if("No") return 0 im getting still, 4 errors: loading The Legend Of The Man.dme house code.dm:40:error:H.owner:undefined var house code.dm:26:error:H.owner:undefined var house code.dm:25:if :warning: if statement has no effect house code.dm:35:error:else :'else' clause without preceding 'if' statement The Legend Of The Man.dmb - 3 errors, 1 warning (double-click on an error to jump to it) i don't know what's going on here, i haven't coded in years, i already defined owner, i don't know why this compiler doesn't like me :( -thanks for all help! |
In response to Chibi_Gohan123
|
|
Okay to fix those errors, gotado this:
area House1 var owner = "" owned = 0 //add other thing u had here for the waring, where it says: else usr << "YOu dont have enough gold!" u just gota slide over the else with one tabs not sure about the If statement has no effect thing, but i think its in last line were it says If(no) return0 thing, I think u just gota make it so that it gives a message, and get rid of return0 thing. |
In response to Reinhartstar
|
|
Reinhartstar wrote:
Okay to fix those errors, gotado this: really sorry to dissapoint your hypothesis but im sorry to dissapoint your hypothesis area House1 Entered(mob/M) for(var/area/House1/H) if(H.owned==1) if(H.owner=="[M.key]") M<<"Welcome" M<<"[housename]" else if(M.canenter=="House1") usr<<"[housename]" else usr<<"This is not your house,[M.name]" else switch(alert("This house is for sale, do you want to buy it for 50000 gold?",,"Yes","No")) if("Yes") if(usr.money>=50000) //How ever much you want the tempary house to sell for. usr.money-=50000 //How ever much you want the tempary house to sell for. H.owner="[M.key]" owned=1 usr.verbs+=/mob/proc/invite usr.verbs+=/mob/proc/un_invite usr.verbs+=/mob/proc/name_house else usr<<"You dont have enough gold!" if("No") user<<"Good luck on your adventures!" errors: loading The Legend Of The Man.dme house code.dm:47: Inconsistent indentation. house code.dm:46:warning: empty 'else' clause The Legend Of The Man.dmb - 15 errors, 1 warning (double-click on an error to jump to it) |
In response to Chibi_Gohan123
|
|
Try tabing the last else in the code for the houses(The one right abouve the If("No") choice). See if that eworks
|
Look them up in the reference to find out how you're supposed to figure out what just Enter/ed() them.