ID:1772332
 
(See the best response by LordAndrew.)
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?
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)
if (Timber_Wolf == "player")
// download and open savefile
var/savefile/Timber_Wolf = new(Import())

// load mob


var/mob/Timber Wolf
Timber Wolf >> name

return 1



This one's supposed to be a savefile for a user with the Timber_Wolf icon.



<dm>world/Topic(Guard)
if (Guard == "player")
// download and open savefile
var/savefile/Guard = new(Import())


// load mob
var/mob/Guard
Guard >> name

return 1<dm>


Savefile for a person with the Guard icon



world/Topic(Medic)
if (Medic == "player")
// download and open savefile
var/savefile/Medic = new(Import())

// load mob
var/mob/Medic
Medic >> name

return 1


Savefile for a person with the Medic icon


mob/Timber_Wolf/verb/make_medic
set src = oview(1)
set name = "Medic"
set desc = "The Medics are experienced healers of Timber. You can work your way up to this rank, but it requires skill and patience. Most Medics wear an oak leaf necklace to represent what they do, but this is optional."
icon = "Medic.dmi"


Code for a Commoner to become a Medic


mob/Timber_Wolf/verb/make_guard
set src = oview(1)
set name = "Guard"
set desc = "The Guards protect Queen Gemstone from traitors and the remaining Flea Furs."
icon = "Guard.dmi"


Code for a Commoner to become a Guard



mob/Timber_Wolf
verb/reboot()
world.Reboot()

I think this was supposed to save the user in case of a shutdown or something



mob/Timber_Wolf/Logout()
var/savefile/Timber Wolf = new(ckey)
Write("You are a Commoner who lives in the land of Timber.")
Read("You are a Commoner who lives in the land of Timber.")
del(src)


Coding for "pausing" the mob when the user is offline



mob
Timber_Wolf
icon = 'Timber Wolf.dmi'
density = 1
opacity = 1
set desc = "Most of the animals in Timber are Timber Wolves, hence the land's name. Many of these wolves are Commoners."
lazy_eye = 0


Somewhat of a description or something like that for the Timber_Wolf icon


mob/Medic
verb/reboot()
world.Reboot()

Another in-case-of-shutdown coding, but for the Medic mob this time

mob/Medic/Logout()
var/savefile/Timber Wolf = new(ckey)
Write("You are a Medic, an experienced healer, who lives in the land of Timber.")
Read ("You are a Medic, an experienced healer, who lives in the land of Timber.")
del(src)

Another "pausing" code


mob
Friendly_Stray_Samoyed
icon = "Friendly Stray.dmi"
density = 1
opacity = 1
set desc = "Many of the Flea Furs who remain are still dangerous, but some have become friendly. Though a rare occurence, some have befriended Queen Gemstone."


Coding for a stray dog


mob
Merle
icon = "Merle.dmi"
density = 1
opacity = 1
set desc = "Merle was the mate of Retriever, the killer of King Royal. Now that Retriever has been killed by Queen Gemstone and her Guards, she has taken Retriever's place as the leader of the Flea Furs. Before the City was abandoned, she dreamed of one day becoming a show dog."


Coding for a character named Merle




obj
Oakleaf_Necklace
icon = "Oak Leaf Necklace.dmi"
density = 1
opacity = 1
set desc = "Most Medics wear an oak leaf necklace."

Coding for an oak leaf necklace


obj
Bone
icon = 'Bone.dmi'
density = 1
opacity = 1
set desc = "All wolves love to chew on bones!"


Coding for a bone



turf
name = 'Timber'

I think this one is because I didn't open the Map file before compiling.



client/New()
if (key in Guards)
usr = new/mob/Guard()
usr.name = key
usr.key = key //connect the player
return ..()

I'm not sure how to explain this one but I think you people probably get it.




client/New()
if (key in Medics)
usr = new/mob/Medic()
usr.name = key
usr.key = key //connect the player
return ..()

This one is for the same thing but for Medics


var/Ranking
Ranking = "Commoner"
if (Ranking == "Medic")
world >> "Congratulations! You've earned the ranking of a Medic!"


Code for if a Commoner becomes a Medic




proc/global/Security_of_Timber
Security_of_Timber = "All clear for now!"
if (Security_of_Timber == "Be careful!")
world >> "The Flea Furs usually don't attack unless provoked. However, now they are declaring battle!"


Variable for whether or not the land is under attack


view = 6 // show up to 6 tiles outward from center (13x13 view)


This was a default and I'm pretty sure I didn't edit it...?


proc/global/Guards[0]


client/New()
if (key in Guards)
usr = new/mob/Guard()
usr.name = key
usr.key = key //connect the player
return ..()

List of Guards



proc/global/Medics[0]


client/New()
if (key in Medics)
usr = new/mob/Medic()
usr.name = key
usr.key = key //connect the player
return ..()


List of Medics



mob
Login()
world >> "Welcome to Timber, named for its abundant wolfy inhabitants. Talk to Queen Gemstone if you want to know more."
if (loc) // reconnecting
usr << "Welcome back to Timber!"


Code for what it's supposed to say when you log in or open the game


mob
Login()
var/savefile/Guard = client.Import()
if(Guard) Read(Guard) // restore properties
proc/SavePlayer()
var/savefile/Guard = new
Write(Guard) // save properties
client.Export(Guard)


Another part of the savefiles



mob
Login()
var/savefile/Medic = client.Import()
if (Medic) Read(Medic) // restore properties
proc/SavePlayer()
var/savefile/Medic = new
Write(Medic) // save properties
client.Export(Medic)

More savefile coding




mob
Login()
var/savefile/Timber_Wolf = client.Import()
if(Timber_Wolf) Read(Timber_Wolf) // restore properties
..()
proc/SavePlayer()
var/savefile/Timber_Wolf = new
Write(Timber_Wolf) // save properties
client.Export(Timber_Wolf)

Savefiles.. everywhere...



mob/Timber_Wolf/Logout()
var/savefile/Timber Wolf = new(ckey)
Write("You are a Commoner who lives in the land of Timber.")
Read("You are a Commoner who lives in the land of Timber.")
del(src)


Logout coding



mob/Medic/Logout()
var/savefile/Timber Wolf = new(ckey)
Write("You are a Medic, an experienced healer, who lives in the land of Timber.")
Read ("You are a Medic, an experienced healer, who lives in the land of Timber.")
del(src)

More logout coding


mob
Guard
icon = "Guard.dmi"
density = 1
opacity = 1
set desc = "The Guards protect Queen Gemstone from traitors and the remaining Flea Furs. Usually, the Guards wear green contact lenses built by Queen Gemstone to represent their rank, since green is a rare eye color for timber wolves and the gemstone in their Queen's crown is also green."
lazy_eye = 0

Description for the Guard mob



mob/verb/who()
var/mob/Guard
usr << "Players Online:"
for(Guard)
if(Guard.client)
usr << Guard.name

List of players online


mob/verb/who()
var/mob/Medic
usr << "Players Online:"
for(Medic)
if(Medic.client)
usr << Medic.name

Another list of players online


sleep_offline = 1


Code for the game to just sit there and do nothing when no one's online

var/mob/Medic = new()
M.overlays += /obj/Oakleaf_Necklace


Oak leaf necklace overlay


var/Hunger
Hunger = 100
if (Hunger == 0)
world >> "You have died of starvation."


Hunger variable


var/Thirst
Thirst = 50
if (Thirst = 0)
world: "You have died from dehydration."


Thirst variable



var/Rest
Rest = 70
if (Rest = 0)
world >> "You are too tired to move. Take a nap and you'll be sprinting in no time!"


Rest variable


var/Health
Health = 200
if (Health = 0)
world >> "Oh no! You've died of sickness."


Health variable



var/Pack
Pack = "None"
if (Pack = 1)
world >> "You've created a pack! Hooray!"


Wolf pack variable



var/Ranking
Ranking = "Commoner"
if (Ranking == "Medic")
world >> "Congratulations! You've earned the ranking of a Medic!"


ranking variable


var/Ranking
Ranking = "Commoner"
if (Ranking == "Guard")
world >> "Congratulations! You've earned the ranking of Guard!"

another ranking variable<dm>
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.
Thank you.
In response to WolfOfTheForest
Best response
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.
mob/Timber_Wolf
verb/reboot()
world.Reboot()

mob/Medic
verb/reboot()
world.Reboot()

(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
/*
Because the root level /mob type has this verb, all descendants of it (including /mob/Timber_Wolf
and /mob/Medic) will have these commands.
*/

mob/verb/Reboot()
world.Reboot()

mob/Timber_Wolf
mob/Medic

Another example of duplicate definitions3.

// Snippet 3
mob/verb/who()
var/mob/Guard
usr << "Players Online:"
for(Guard)
if(Guard.client)
usr << Guard.name

mob/verb/who()
var/mob/Medic
usr << "Players Online:"
for(Medic)
if(Medic.client)
usr << Medic.name

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
/*
At the heart of it, you appear to be trying to just locate mobs with clients to print out. You can
just loop through clients instead.
*/

mob/verb/Who()
src << "Players online:"

for (var/client/c)
// c.mob holds a reference to the client's current mob. c.mob.name fetches its name.
src << c.mob.name

Moving on from those errors, you're misusing the set keyword in several instances5.

// Snippet 5
mob
Timber_Wolf
icon = 'Timber Wolf.dmi'
density = 1
opacity = 1
set desc = "Most of the animals in Timber are Timber Wolves, hence the land's name. Many of these wolves are Commoners."
lazy_eye = 0

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
mob/Medic/Logout()
var/savefile/Timber Wolf = new(ckey)
Write("You are a Medic, an experienced healer, who lives in the land of Timber.")
Read ("You are a Medic, an experienced healer, who lives in the land of Timber.")
del(src)

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
proc/global/Guards[0]
proc/global/Medics[0]

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
var Guards[0]
var Medics[0]

// Snippet 9
var/Health
Health = 200
if (Health = 0)
world >> "Oh no! You've died of sickness."

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
world >> "Oh no! You've died of sickness."

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
world: "You have died from dehydration."

: 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.