turf/house
var/mob/owner = null
door
icon = 'turfs.dmi'
icon_state = "Door"
density = 1
name = "Door"
verb/own()
if(usr.gold <= 999)
usr << "You need 1000 zenni!"
if(usr.gold >= 1000)
usr << "You have bought the house!"
usr.gold -= 1000
src.owner = usr.key
usr.house = 1
set src in view(1)
set category = "Communication"
src.owner = usr
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 = 'turfs.dmi'
icon_state = "11111"
Enter(mob/M)
if(ismob(M))
if(M.client)
if(src.owner == M)
return ..()
else
M <<"This is not your room."
return 0
There is an error there. Well actualy 12 inconsistant indentations please help me.</<num></<o>
ID:261892
Dec 21 2003, 3:36 pm
|
|
Dec 21 2003, 3:47 pm
|
|
hmm, all u have to do is check with the indentation, i can't really help u w/o the code but i can say that if u mess with it and it comes out wrong, change it back, just keep trying differnent things
|
I don't know anything about "house coding." I also don't know anything about combat coding or death check coding or door coding. I don't know anything about "anything" coding... and you're better off if you learn not to worry about "whatever" coding, like, RIGHT NOW.
See, there's no such thing as a house, and there's no such thing as combat... code is code, it's all meaningless to the computer except that it's instructions... and those instructions have to be phrased in a way that makes sense to the compiler. The compiler figures out which code "belongs" to which object or procedure by how you indent it. "Inconsistent indentation" means, you indented wrong. Like, you used spaces in one place but indentation everywhere else, or you've indented more than you need to or less than you need to. "So what do I change?" Whatever you did wrong! Don't know? Then learn. Learn how to indent properly, learn how to know if something needs to be indented more and, how much. It doesn't matter what you're coding... a "house", a "vehicle", a "spoon"... 'cause as far as the compiler cares, there is no house, there is no vehicle, and there is no fricking spoon... the same principles apply. Under no circumstances should any line be indented more than one time more than the line above it. It should only be indented more if it's subordinate in some way... it belongs to or is ruled by the line above. if (this) then that else these "then that" and "these" only happen when the if or the else are true stuff += kapow thwip -= snikt No indenting! thwip doesn't belong to stuff, both lines happen no matter what. |
In response to Chibi_Gohan123
|
|
just keep trying differnent things Hi there, Chibi. Not sure if the other mods will back me up, but next time you give someone this advice, I'm going to delete it. If that's how you make your game, that's good enough for you, but don't share that kind of wisdom around with other people who are just setting out and trying to learn. "Change things at random until it works!" is not good advice. Code indentation works along very logical and surprisingly simple rules... it's not random, it's not a mystery, and it's sure as heck not a guessing game. If you do something at random and it "works"... chances are, it really doesn't. Just becaue something compiles doesn't mean it won't give you runtime errors, and just because something doesn't give you runtime errors means it will do what you want it to do, and just because it seems to do what you want it to in testing doesn't mean it's actually doing what it seems. If you don't know what you did to fix something... then it ain't fixed. |
In response to Hedgemistress
|
|
Hedgemistress wrote:
Hi there, Chibi. Not sure if the other mods will back me up, but next time you give someone this advice, I'm going to delete it. If that's how you make your game, that's good enough for you, but don't share that kind of wisdom around with other people who are just setting out and trying to learn. Heck, I've had a policy for a long time now of outright deleting posts whose advice is so bad (and, usually, not corrected yet) that they make the situation worse. Lummox JR |
Nobody really helped this guy....
turf/house That should fix those errors. |
In response to Coolroman123
|
|
I beg to differ, a "quick fix" isn't more helpful, only more convenient in the very, very short term, and often harmful over the long.
If he couldn't tell what an inconsistent indentation error was or how to fix it based on that... then fixing the indentation for him is the worst thing you can do. If that's all you do, then he still doesn't understand indentation and he'll get the same error again. When someone's learning how to handle a weapon and still isn't even sure which end to point at the target, you don't start by loading it with live ammo, taking the safety off, and saying, "Go to town!" |