ID:148152
 
obj/BlueFlag
icon = 'flag.dmi'
verb
GetFlag()
set category="Actions"
set src in oview(1)
if(usr.team=="Red")
Move(usr)
world<<"The blue flag has been taken!"
else
{src} "You can't pick up your own flag!"
obj/RedFlag
icon = 'flag2.dmi'
verb
GetFlag()
set category="Actions"
set src in oview(1)
if(usr.team=="Blue")
Move(usr)
world<<"The Red flag has been taken!"
else
{src} "You can't pick up your own flag!"


My error is

Flags.dm:12:error: expected expression

(Which is referring to "obj/RedFlag")

Now If I put that into a different codefile, It makes the whole codefile completely in erroe. Whats with this?
{src}"" is the problem, use src<<""
In response to Crashed
:X, Only gives me 10 errors now...


Flags.dm:5:error:set :invalid proc definition
Flags.dm:6:error:set :invalid proc definition
Flags.dm:7:error:if :invalid proc definition
Flags.dm:8:error::invalid proc definition
Flags.dm:10:error:else :invalid proc definition
Flags.dm:16:error:set :invalid proc definition
Flags.dm:17:error:set :invalid proc definition
Flags.dm:18:error:if :invalid proc definition
Flags.dm:19:error::invalid proc definition
Flags.dm:21:error:else :invalid proc definition
In response to JordanUl
You forgot to indent everything under the verb.

~>Volte
In response to Volte
Mid If I ask for one more tip?

obj/RedFlag
icon = 'flag2.dmi'
verb
GetFlag()
set category="Actions"
set src in oview(1)
if(usr.team=="Blue")
Move(usr)
world<<"The Red flag has been taken!"
else
src<< "You can't pick up your own flag!"


Now I thought I had the variable for usr.team figured out but I obviously don't. How would I set up a variable like Blue or Red so it would fit with usr.team?

Error -

Flags.dm:7:error:usr.team:undefined var
Flags.dm:18:error:usr.team:undefined var
In response to JordanUl
mob
Login()
mob/var/team = input("What team do you want to be on?") in list("Blue","Red")
if("Blue")
src.team = "Blue"
else if("Red")
src.team = "Red"


Not sure if you reall need the src.team stuff, just there to make sure...
In response to Dragon of Ice
Dragon of Ice wrote:
mob
Login()
mob/var/team = input("What team do you want to be on?") in list("Blue","Red")
if("Blue")
src.team = Blue
else if("Red")
src.team = Red
Not sure if you reall need the src.team stuff, just there to make sure...

There's a sure-fire way to pick up a compiler error; you forgot to put quotes around blue and red.

Lummox JR
In response to Lummox JR
Whoopsy daisy!
This is really the wrong way to set up teams. By creating two separate types for everything, you end up with a lot of redundant code--and twice the chance for bugs.

The correct way to handle this is to give everything that might be team-related a team var, and initialize that to the right team. For instance:
obj/flag
var/team
A team var could be a simple string, which is good enough for a lot of purposes, or a special datum for handling teams. The latter is much better and will save a lot of grief in the long run.

Lummox JR
In response to Lummox JR
I have been here for roughly 1 and a half years, and I'm still the stupidest coder here :X, so I basically use any brute force coding I can get my hands on.