What does the program mean when it mentions warnings? I just deleted some verbs I didn't want to write for now and tried to compile the code and suddenly it says I have five warnings... Help?
|
Jan 28 2015, 11:25 am
|
|
Warnings mean that you have something suspect going on that may or may not break things at runtime. Without knowing what exactly the warnings are though, we can't say for sure or comment on how to fix them.
|
A warning basically means that there's something questionable in the code, but nothing that would disable the compiler from compiling what you've written.
For example, creating a var for a particular proc and not using it later in the procedure. There's nothing illegal about it, just the system warning you of a potential mistake you've may have missed. |
I had almost every last compilation error in the code fixed, then I compiled it and suddenly I have 100 for some reason when it said absolutely nothing about those errors before.
Here's what it says: loading Timberwolf.dme Timberwolf (Preview).dm:122:error: Timber_Wolf: duplicate definition Timberwolf (Preview).dm:119:error: Timber_Wolf: previous definition Timberwolf (Preview).dm:126:error: TimberWolf: missing = Timberwolf (Preview).dm:127:error: Wolf: undefined var Timberwolf (Preview).dm:134:error: Guard: duplicate definition Timberwolf (Preview).dm:131:error: Guard: previous definition Timberwolf (Preview).dm:138:error: Guard: duplicate definition Timberwolf (Preview).dm:147:error: Medic: duplicate definition Timberwolf (Preview).dm:144:error: Medic: previous definition Timberwolf (Preview).dm:150:error: Medic: duplicate definition Timberwolf (Preview).dm:364:error: make_medic: invalid proc definition Timberwolf (Preview).dm:371:error: make_guard: invalid proc definition Timberwolf (Preview).dm:166:error: Reboot: undefined proc Timberwolf (Preview).dm:204:error: Wolf: undefined var Timberwolf (Preview).dm:204:error: new: bad variable definition Timberwolf (Preview).dm:272:error: desc: bad variable Timberwolf (Preview).dm:273:error: lazy_eye: undefined var Timberwolf (Preview).dm:171:error: Reboot: undefined proc Timberwolf (Preview).dm:211:error: Wolf: undefined var Timberwolf (Preview).dm:211:error: new: bad variable definition Timberwolf (Preview).dm:289:error: desc: bad variable Timberwolf (Preview).dm:290:error: lazy_eye: undefined var Timberwolf (Preview).dm:176:error: Reboot: undefined proc Timberwolf (Preview).dm:218:error: Wolf: undefined var Timberwolf (Preview).dm:218:error: new: bad variable definition Timberwolf (Preview).dm:298:error: desc: bad variable Timberwolf (Preview).dm:299:error: lazy_eye: undefined var Timberwolf (Preview).dm:281:error: desc: bad variable Timberwolf (Preview).dm:307:error: desc: bad variable Timberwolf (Preview).dm:304:error: "Flea Fur Stray.dmi": bad file Timberwolf (Preview).dm:315:error: desc: bad variable Timberwolf (Preview).dm:312:error: "Flea Fur Stray 2.dmi": bad file Timberwolf (Preview).dm:323:error: desc: bad variable Timberwolf (Preview).dm:320:error: "Friendly Stray 2.dmi": bad file Timberwolf (Preview).dm:339:error: desc: bad variable Timberwolf (Preview).dm:336:error: "Friendly Stray.dmi": bad file Timberwolf (Preview).dm:347:error: desc: bad variable Timberwolf (Preview).dm:344:error: "Merle.dmi": bad file Timberwolf (Preview).dm:331:error: desc: bad variable Timberwolf (Preview).dm:328:error: "Oak Leaf Necklace.dmi": bad file Timberwolf (Preview).dm:355:error: desc: bad variable Timberwolf (Preview).dm:27:error: 'Timber': cannot find file Timberwolf (Preview).dm:438:error: Guards: undefined var Timberwolf (Preview).dm:449:error: Medics: undefined var Timberwolf (Preview).dm:415:error: Ranking: duplicate definition Timberwolf (Preview).dm:421:error: Ranking: previous definition Timberwolf (Preview).dm:427:error: Security_of_Timber: invalid proc definition Timberwolf (Preview).dm:434:error: proc/global/Guards: undefined var Timberwolf (Preview).dm:445:error: proc/global/Medics: undefined var Timberwolf (Preview).dm:127:warning: Timber: unused label Timberwolf (Preview).dm:9:error: view: duplicate definition Timberwolf (Preview).dm:9:error: 6: duplicate definition Timberwolf (Preview).dm:9:error: =: duplicate definition Timberwolf (Preview).dm:36:error: "Welcome to Timber, named for its abundant wolfy inhabitants. Talk to Queen Gemstone if you want to know more.": bad variable Timberwolf (Preview).dm:37:error: : invalid expression Timberwolf (Preview).dm:104:error: SavePlayer: duplicate definition Timberwolf (Preview).dm:94:error: SavePlayer: previous definition Timberwolf (Preview).dm:113:error: SavePlayer: duplicate definition Timberwolf (Preview).dm:204:warning: =: variable defined but not used Timberwolf (Preview).dm:211:warning: =: variable defined but not used Timberwolf (Preview).dm:218:warning: =: variable defined but not used Timberwolf (Preview).dm:295:error: "Guard.dmi": bad file Timberwolf (Preview).dm:183:warning: <: statement has no effect Timberwolf (Preview).dm:251:error: who: duplicate definition Timberwolf (Preview).dm:243:error: who: previous definition Timberwolf (Preview).dm:259:error: who: duplicate definition Timberwolf (Preview).dm:23:error: sleep_offline: duplicate definition Timberwolf (Preview).dm:23:error: 1: duplicate definition Timberwolf (Preview).dm:23:error: =: duplicate definition Timberwolf (Preview).dm:31:error: M.overlays: duplicate definition Timberwolf (Preview).dm:31:error: /obj/Oakleaf_Necklace: duplicate definition Timberwolf (Preview).dm:31:error: +=: instruction not allowed here Timberwolf (Preview).dm:387:error: Hunger: duplicate definition Timberwolf (Preview).dm:387:error: 100: duplicate definition Timberwolf (Preview).dm:387:error: =: duplicate definition Timberwolf (Preview).dm:388:error: Hunger: duplicate definition Timberwolf (Preview).dm:388:error: 0: duplicate definition Timberwolf (Preview).dm:388:error: ==: instruction not allowed here Timberwolf (Preview).dm:388:error: : duplicate definition Timberwolf (Preview).dm:394:error: : duplicate definition Timberwolf (Preview).dm:399:error: : duplicate definition Timberwolf (Preview).dm:405:error: : duplicate definition Timberwolf (Preview).dm:411:error: : duplicate definition Timberwolf (Preview).dm:417:error: Ranking: duplicate definition Timberwolf (Preview).dm:417:error: "Medic": duplicate definition Timberwolf (Preview).dm:417:error: ==: instruction not allowed here Timberwolf (Preview).dm:417:error: : duplicate definition Timberwolf (Preview).dm:423:error: Ranking: duplicate definition Timberwolf (Preview).dm:423:error: "Guard": duplicate definition Timberwolf (Preview).dm:423:error: ==: instruction not allowed here Timberwolf (Preview).dm:423:error: : duplicate definition Timberwolf (Preview).dm:429:error: Security_of_Timber: duplicate definition Timberwolf (Preview).dm:429:error: "Be careful!": duplicate definition Timberwolf (Preview).dm:429:error: ==: instruction not allowed here Timberwolf (Preview).dm:429:error: : duplicate definition Timberwolf (Preview).dm:389:error: world: duplicate definition Timberwolf (Preview).dm:389:error: "You have died of starvation.": duplicate definition Timberwolf (Preview).dm:389:error: >>: instruction not allowed here Timberwolf (Preview).dm:389:error: : duplicate definition Timberwolf (Preview).dm:393:error: Thirst: duplicate definition Timberwolf (Preview).dm:393:error: 50: duplicate definition Timberwolf (Preview).dm:393:error: =: duplicate definition Timberwolf (Preview).dm:395:error: world"You have died from dehydration.": value not allowed here Timberwolf (Preview).dm:395:error: : duplicate definition Timberwolf (Preview).dm:398:error: Rest: duplicate definition Timberwolf (Preview).dm:398:error: 70: duplicate definition Timberwolf.dmb - 100 errors, 5 warnings (max count reached) and here are the codes and/or code trees for those: world/Topic(Timber_Wolf) |
In response to WolfOfTheForest
|
|
Please wrap your code snippets in <dm> tags so the forum can apply syntax highlighting and retain indention. Otherwise your code is entirely unreadable.
|
I fixed it... The text where I'm explaining what I was trying to do got mixed in by accident, though. Those parts aren't actually written in there. The "return 1" coding is actually indented better than that, too.
And sorry about that. I couldn't figure out how to do that... |
In response to WolfOfTheForest
|
|
Having scanned over your code I can safely say that none of it will ever compile. You have a very large number of syntactical errors present and are misusing a number of various functions.
Normally I'd break down your snippets and point out what you did wrong and give examples and references on more correct ways, but all of the above code has issues at every turn. I whole-heartedly recommend you take a look through the Guide and learn the basic syntax of DM. |
I did look through the guide (in fact I have it open right now), but its wording kept confusing me...
I'm more used to programs like this one really basic one I found. Maybe that's why I didn't get it? |
In response to WolfOfTheForest
|
|
Alright, gimme a little bit and I'll go through and write up some stuff to help you out here.
|
Alright, here's what I've got so far. It touches upon some of the more glaring issues.
You have a large number of duplicate definitions for various procedures and verbs. For example1. // Snippet 1. (As another note, this produces another error due to your indentation being off. The line world.Reboot() needs to be tabbed over and "under" the verb/reboot() declaration). In snippet 1, you could simplify this by (though I absolutely don't recommend this—reboot really should be a verb that only administrator-types have) giving the reboot() verb to the root /mob type2. // Snippet 2 Another example of duplicate definitions3. // Snippet 3 In snippet 3 you're defining a verb called who(), then later on you define it again (leading to a duplicate definition error). (You also do this with /mob/proc/SavePlayer as well). What you'd want to do is something along the lines of this4 once. // Snippet 4 Moving on from those errors, you're misusing the set keyword in several instances5. // Snippet 5 set is reserved for use within verbs and is not valid within a class definition. You'd just want to declare the desc variable normally like how you're doing with density, opacity, etc. // Snippet 6 To be honest, I'm not sure what you're attempting to do at all here in snippet 6. Read() and Write() accept a /savefile instance as their arguments, not a string. You also don't need to call both of them, especially if you only need to save data. Another point of interest in snippet 6 is this line: var/savefile/Timber Wolf = new(ckey) "Timber Wolf" is not a valid variable name due to the space. It needs to all be one word ("TimberWolf" or "Timber_Wolf" being valid variable names). // Snippet 7 The above7 is invalid syntax. You appear to be trying to define a variable, but you've used the proc keyword instead. Also, the global keyword is both redundant (because any variable or procedure defined at the root level is going to be global by default) and in the event you were attempting to define a procedure, global only applies to variables. You'd want something along these8 lines. // Snippet 8 // Snippet 9 In9 several places you use a single equals symbol (the declaration operator) within the if statement, rather than the double equals symbol (the comparison operator). In all cases you're going to want ==. As a side note (and this is due to how the Guide is written), you don't have to define and then declare variables on multiple lines. var Health = 200 is fine as well, saving you a bit of space (and possibly preventing errors, in case you declare a variable but forget to define it). // Snippet 10 In snippet 10, you're using the >> operator to attempt to output text to world. You want << here instead (think of it as you have the string "Oh no! You've died of sickness." and you're pointing it towards (<<) the world). // Snippet 11 : isn't valid here. Use <<. There are still several other issues present, but I'll give you a chance to touch upon the ones I've explained above first. |
I have less errors now, but it's still saying there are 41 left. I deleted the variables to help with fixing, I might put them back in just to test them later, but you can still explain if there are any more problems with the variables.
I don't know if this is useful information or not, but on the other program I mentioned, code is written in a more basic way and called "script". So when you "script" a variable on there,since it's drag and drop, usually it looks like this, for example a Hunger variable would be kind of like this (only different because I can't copy and paste the coding from there onto here): variable[Hunger] = 100 wait[100]sec broadcast[starve] when[starve]broadcasted switch to [background1] Something like that is what I'n used to, that's probably why I'm having so many problems in the Dream Maker... I didn't put the "script" above in the HTML for making code look like it does in BYOND because it's not from this program. |