ID:262600
 
Code:
world/mob = /mob/BaseCamp/ChoosingCharacter

world
view = 6

mob/BaseCamp/ChoosingCharacter
Login()
spawn()
usr.loc = locate(10,10,4)
usr.freeze = 1
return ..()

mob
var
freeze = 0

mob/Move()
if(src.freeze == 1)
return
else
..()



var
list
bannednames=list("1","2","3","4","5","6","7","8","9","0"," ","<",">","!",".",",","+","\",",")","(","*","&","^","%","$","#","@","!","~","`")


mob/var/HasItUp = 0

obj
TITLE
icon = 'LOGIN_SCREEN.bmp'
name = ""
layer = 200

NEW
Click()
if(usr.HasItUp == 0)
usr.HasItUp = 1
var/mob/character
crap:
var/charactername1 = input("What is your character's name?","Character Name?")as null|text
if(charactername1 == null || charactername1 == "" || charactername1 == " "|| charactername1 == " " || charactername1 == " ")
usr.HasItUp = 0
return
var/m = copytext(charactername1,1,2)
var/v = uppertext("[m]")
var/c = copytext(charactername1,2,11)
var/b = lowertext(c)
var/charactername = "[v][b]"
for(var/X in bannednames)
if(findtext(charactername,X))
alert(usr,"Name rejected..","DENIED!")
goto crap
switch(input("Which race would you like to be.","Character Creation") in list("SynShenron","Saiyan","Cell","Icer","Human","Namek","Buu"))
if("SynShenron")
icon = 'Syn Shenron.dmi'
new_mob = new /mob/SynShenron()
if("Saiyan")
icon = 'Saiyan.dmi'
new_mob = new /mob/Saiyan()

switch(input("What Hair Style Would You Like?","Character Customisation")in list("Goku","Vegeta","Gohan","Trunks","Gotenks"))
if("Goku")
new_mob.overlays+=/obj/Goku
if("Vegeta")
new_mob.overlays+=/obj/Vegeta
if("Trunks")
new_mob.overlays+=/obj/Trunks
if("Gohan")
new_mob.overlays+=/obj/Gohan
if("Gotenks")
new_mob.overlays+=/obj/Gotenks



if("Cell")
icon = 'Cell.dmi'
new_mob = new /mob/Cell()
new_mob.overlays+=/obj/characterhead
if("Icer")
icon = 'Icer.dmi'
new_mob = new /mob/Icer()
if("Namek")
new_mob=new/mob/Namek()
if("Buu")
new_mob=new/mob/Buu()
new_mob.overlays+=/obj/buuhead
if("Human")
icon = 'Human.dmi'
new_mob = new /mob/Human()

switch(input("What Hair Style Would You Like?","Character Customisation")in list("Goku","Vegeta","Gohan","Trunks","Gotenks"))
if("Goku")
new_mob.overlays+=/obj/Goku
if("Vegeta")
new_mob.overlays+=/obj/Vegeta
if("Trunks")
new_mob.overlays+=/obj/Trunks
if("Gohan")
new_mob.overlays+=/obj/Gohan
if("Gotenks")
new_mob.overlays+=/obj/Gotenks

new_mob.name = char_name
new_mob.loc=locate(100,67,1)


src.client.mob = new_mob

del(src)



mob/SynShenron
icon='Syn Shenron.dmi'

mob/Saiyan
icon='Saiyan.dmi'

mob/Cell
icon='Cell.dmi'

mob/Icer
icon='Icer.dmi'

mob/Human
icon='Human.dmi'
mob
Login()
world<<"<font color = green><B>[usr] the <font color = silver><B> [race] <font color = green><B> has logged in"

..()


Logout()
world<<"<font color = green><B>[usr] has logged out"
del(src)

else
return
LOAD
Click()
if(usr.HasItUp == 0) //line with error
usr.HasItUp = 1
var/savefile/F = usr.client.base_PlayerSavefile()
F.cd = "/players/[usr.ckey]/mobs/"
var/list/characters = F.dir
var/b = 0
var/entry
var/autoname = ""
for (entry in characters)
b ++
for(entry in characters)
if(b == 1)
autoname = entry
if(b == 0)
usr << "You don't have any saved characters on this server."
if(b == 1)
usr.client.base_LoadMob(autoname)
else
var/name = input("What is the name of the character you want to load?","Character Load") in usr.client.base_CharacterNames() + list("Cancel")
if(name == "Cancel")
usr.HasItUp = 0
return
else
usr.client.base_LoadMob(name)
else
return
DELETE
Click()
var/savefile/F = usr.client.base_PlayerSavefile()
F.cd = "/players/[usr.ckey]/mobs/"
var/list/characters = F.dir
var/b = 0
for (var/entry in characters)
b ++
if(b == 0)
usr << "You don't have any saved characters on this server."
if(usr.HasItUp == 0)
usr.HasItUp = 1
var/name = input("What is the name of the character you want to delete?","Character Delete") in usr.client.base_CharacterNames() + list("Cancel")
if(name == "Cancel")
usr.HasItUp = 0
return
else
switch(alert("Are you absolutely sure you want to delete [name]?","Character Delete","No","Yes"))
if("Yes")
usr.HasItUp = 0
usr.client.base_DeleteMob(name)
if("No")
usr.HasItUp = 0
return
else
return

Problem description:
I dont understand whats wrong with it... This is the error line.

if(usr.HasItUp == 0)

loading DragonBall Global.dme
Title Screen.dm:147:error: proc definition not allowed inside another proc

DragonBall Global.dmb - 1 error, 0 warnings (double-click on an error to jump to it)
Okay, first off, change all the 'usr' to 'src'. Second, you might want to work on your indentation. And try using '=' not '=='.
In response to Plagu3r
Please, don't give crappy advice.

Firstly, check out Wizzy's Bwiki article called The Usr Lecture. Usr is allowed in Click(), but not in other procs.

Also, Goto is bad. Don't use it, you can use while() instead. Also, you have indentation errors probably, but I can't tell because you didn't specify exactly which line, and i'm not looking for it.
In response to N1ghtW1ng
N1ghtW1ng wrote:
Please, don't give crappy advice.

Firstly, check out Wizzy's Bwiki article called The Usr Lecture. Usr is allowed in Click(), but not in other procs.

Also, Goto is bad. Don't use it, you can use while() instead. Also, you have indentation errors probably, but I can't tell because you didn't specify exactly which line, and i'm not looking for it.

Ok..ay....
In response to N1ghtW1ng
Could you do me a favor and define "crappy advice". Last I checked, any advice is good. <<
In response to Plagu3r
Not when it doesn't help.
In response to N1ghtW1ng
How did that advice vary from your advice? I gave my opinion to attempt to help, and you critize me? I'm sorry, maybe someone forgot to tell me that you made the "advice standards". =/
In response to Plagu3r
You told him to change all of the instances of usr to src, which is bad. If you read Wizzy's article that I posted on your thread, you would see that in Click and Dblclick, usr is correct.
In response to N1ghtW1ng
Ahh, yes mistake on my end. I didn't check the code end to notice that. Still, no reason for you to attempt to jump down me... <<;
In response to Plagu3r
Plagu3r wrote:
Ahh, yes mistake on my end. I didn't check the code end to notice that. Still, no reason for you to attempt to jump down me... <<;

You guys aint helping me xD
In response to Virtue Productions
I need help....
In response to Plagu3r
Plagu3r wrote:
Still, no reason for you to attempt to jump down me... <<;

He didn't jump down on you, he got a little mad because he saw you giving help on the wrong way. So he corrected you.

O-matic
In response to O-matic
He should have stated that my advice was not helping. -.-
In response to Plagu3r
Plagu3r wrote:
He should have stated that my advice was not helping. -.-

And that is exactly what he did.

O-matic
In response to O-matic
What is the problem with this coding?
In response to N1ghtW1ng
Goto isn't 'bad',Its just not the best means of looping in this situation.


Itanium
In response to Itanium
Itanium wrote:
Goto isn't 'bad',Its just not the best means of looping in this situation.


Itanium

Wrong, goto IS bad. You'll rarely ever use it. I'd like to quote LummoxJR on this one:




LummoxJr wrote ( something along the lines of ):
You should never use goto unless it's a loop so complex that goto is your only answer.

I myself have rarely ever used goto, if ever.




Goto can generally cause problems in your program.
In response to Audeuro
I still fail to see your reason for calling it bad.

Itanium
In response to Itanium
I still fail to see your reason for calling it bad.

Goto is bad form and is generally much less clear than a standard loop and it tends to lead to spaggetti code. It should only be used when you know what you ae doing and it is the best solution which is generally never the case.
In response to Itanium
Because DM has such a shallow learning curve, and much of the developer community are persons actively trying to learn the language, many lesser understood aspects of the language are seen as 'dangerous' and are labeled as 'bad.' Examples include the famous 'usr is evil,' 'goto is wrong,' and 'brackets and semicolons are bad.'

Though these maxims are generally okay to follow if they help the individual programmer, programmers who are used to other languages are often offended when what is perfectly fine in other languages (and often perfectly fine in DM) is emphatically denounced as 'wrong' or 'bad.'

Though I try to teach myself good programming practices, and attempt to find the best way to do something, I do not see this as mutually exclusive to using commands which others might view to be 'obscure.' Just because the uses of 'goto' may be few and far between, does not mean that the use of 'goto' carries any moral weight. In my opinion, the only code that 'wrong' is the code that returns an error (or has the potential to return an error); I believe this emphatically.
Page: 1 2