ID:1999532
 
(See the best response by Nadrew.)
Code:
obj/Carrier
var
carrier
Traveltime = 0
verb/Send_Message(var/mob/M in world)
set in view(1)
switch(alert("Are you sure you want to send a message? It'll take awhile",,"Yes","No"))
if("Yes")
if(Traveltime == 0)

if(!M||!ismob(M)) return
var/CarriMess=input(src,"Who would you like to send it to") as text
if(!CarriMess) return
carrier=CarriMess
if(M.z>=usr.z||M.z<=usr.z)
src<<output("Send")
Traveltime = 1
sleep(18000)
Traveltime = 0
M<<output("A carrier appears with a note.")
sleep(50)
switch(input(M,"Read?") in list("Yes","No"))
if("Yes")
M<<output("[carrier]")
src<<output("The carrier has delivered the message")
else
src<<output("Send")
sleep(500)
M<<output("A carrier appears with a note.")
sleep(50)
switch(input(M,"Read?") in list("Yes","No"))
if("Yes")
M<<output("[Bird]")
src<<output("The carrier has delivered the message")
else
usr<<output("Wait please.")


Problem description:
So. The problems I am having is with the alert and input, no matter how I write it to my knowledge of this process it continues to give me errors.
carrier:9:error: alert: bad variable definition
carrier:9:error: switch: invalid variable name: reserved word
carrier:18:error: =: expected a constant expression

Best response
You have your entire verb indented one tab too far, I imagine there's more wrong with the code itself, but I honestly stopped reading at that line.
I guess I was paying to much attention to the var instead of the actual start of the verb.
I was wondering why it looked so weird. Copy pasted it into a .dm file.

Alright you're using space to indent the code, that's no Bueno you need to use tab to handle your indentation... verb is like two indentations too much.
You can use spaces to indent, or tabs, but not both.
In response to Nadrew
Nadrew wrote:
You can use spaces to indent, or tabs, but not both.

You shouldn't use spaces, once you get into walls of code and you miss spaces on certain lines every once in a while you'll start to get headaches.

Thank you for pointing it out it seems to work now.
In response to DarkTemplarX96
DarkTemplarX96 wrote:
Nadrew wrote:
You can use spaces to indent, or tabs, but not both.

You shouldn't use spaces, once you get into walls of code and you miss spaces on certain lines every once in a while you'll start to get headaches.


There's no standard against it, and pressing ctrl+t will reveal mis-steps in the process. It really comes down to the preference of the developer writing the code. It's probably easier and more reliable to use tabs, but there's nothing to say you shouldn't.

In response to Nadrew
Nadrew wrote:
DarkTemplarX96 wrote:
Nadrew wrote:
You can use spaces to indent, or tabs, but not both.

You shouldn't use spaces, once you get into walls of code and you miss spaces on certain lines every once in a while you'll start to get headaches.


There's no standard against it, and pressing ctrl+t will reveal mis-steps in the process. It really comes down to the preference of the developer writing the code. It's probably easier and more reliable to use tabs, but there's nothing to say you shouldn't.

He's clearly a beginner so I personally think promoting spaces for indentation isn't a good choice. He'll learn quicker by using every means to properly organize his code which I think includes tabbing.

#votetab2016

I was using tabs btw. I confused myself overall and tabbed it after I created the vars. I would of never noticed it either until you guys pointed it out and I fixed it.
and idk who to vote for xD yall both pointed it out but nadrew was first
Obviously DarkTemplar-Senpai
In response to DarkTemplarX96
DarkTemplarX96 wrote:
I was wondering why it looked so weird. Copy pasted it into a .dm file.

Alright you're using space to indent the code, that's no Bueno you need to use tab to handle your indentation... verb is like two indentations too much.

Copy and pasting code from the website to a .dm file turns all tabs into spaces. It's not that he was using them, it's just how it works.
In response to Reformist
Reformist wrote:
DarkTemplarX96 wrote:
I was wondering why it looked so weird. Copy pasted it into a .dm file.

Alright you're using space to indent the code, that's no Bueno you need to use tab to handle your indentation... verb is like two indentations too much.

Copy and pasting code from the website to a .dm file turns all tabs into spaces. It's not that he was using them, it's just how it works.

It has never in the history of life ever done that to me before.
In response to DarkTemplarX96
DarkTemplarX96 wrote:
I was wondering why it looked so weird. Copy pasted it into a .dm file.

Alright you're using space to indent the code, that's no Bueno you need to use tab to handle your indentation... verb is like two indentations too much.

using spaces instead of tabs isn't taboo, or against conventions lol, as long as ur being consistent it makes no diff. it only matters if ur using a shitty IDE
In response to Zagros5000
Zagros5000 wrote:
DarkTemplarX96 wrote:
I was wondering why it looked so weird. Copy pasted it into a .dm file.

Alright you're using space to indent the code, that's no Bueno you need to use tab to handle your indentation... verb is like two indentations too much.

using spaces instead of tabs isn't taboo, or against conventions lol, as long as ur being consistent it makes no diff. it only matters if ur using a shitty IDE

My whole point was for a beginning programmer it'd be better for them to get used to indenting using tab. Lol