ID:144512
 
Code:
turf/Tittl_screen
Tittle_Screen
icon = 'MKALogin.png'

Create_Kombatant
icon = 'Create Kombatant.png'
Click()
src.ChooseCharacter()
proc/ChooseCharacter()
src.name = input("Please name your kombatant. ","Name input")
switch(input("Please choose your kombatant.") in list("Scorpion","Sub-Zero"))
if("Scorpion")
icon = 'Scorpion.dmi'
icon_state = "scorpion"
world << "<font color=gray size=2> -SERVER INFO- <font color = green>[src]Logged in for the first time."
usr.loc = locate(1,1,2)
Save()
if("Sub-Zero")
icon = 'Sub zero.dmi'
icon_state = "subzero"
world << "<font color=gray size=2> -SERVER INFO- <font color = green>[src]Logged in for the first time."
usr.loc = locate(1,1,2)
Save()
Logout()
if(cansave)
Save()
world << "<font color=gray size2> -SERVER INFO- <font color = green> [src] has logged out of Armageddon."
..()
del(src)



Load_Kombatant
icon = 'Load Kombatant.png'
Click()
proc/Load()
var/savefile/F=new("saves[rsc.key].sav")
cansave = 1
Read(F)
var/lx,ly,lz
F["last_x"] >> lx
F["last_y"] >> ly
F["last_z"] >> lz
loc = locate(lx,ly,lz)
world << "<font color=gray size=2> -SERVER INFO- <font color = green>[src] Has re-joined Armageddon."
Save()


Quit_Kombatant
icon = 'Quit Kombatant.png'
Click()
proc/Save()
var/savefile/F = new("saves/[src.key].sav")
Write(F)
F["last_x"] << x//Writes over their last with their new one.
F["last_y"] << y
F["last_z"] << z
src << "<font color=gray size2> -USER INFO- <font color =green> <font color = orange>Your game has been saved!"
Save()
..()


Problem description:

I am getting 3 errors given to me in one line and here is the error.

error: proc definition not allowed inside another proc

- 3 errors, 0 warnings

can somone help me with this.
The load(), save() and logout() procs are intented one space too many. They are inside the Choose_character() proc.
In response to Dice1989
when u say intented do u mean indented?
In response to Dbgtsuperfreak
Yeah, typo, my bad.
In response to Dice1989
well when I do indent them I get 22 inconsistant indentation errors. re-copy the code and fix it so i can see waht u did.
In response to Dbgtsuperfreak
Dbgtsuperfreak wrote:
Code:
> turf/Tittl_screen
> Tittle_Screen
> icon = 'MKALogin.png'
>
> Create_Kombatant
> icon = 'Create Kombatant.png'
> Click()
> src.name = input("Please name your kombatant. ","Name input")
> switch(input("Please choose your kombatant.") in list("Scorpion","Sub-Zero"))
> if("Scorpion")
> icon = 'Scorpion.dmi'
> icon_state = "scorpion"
> world << "<font color=gray size=2> -SERVER INFO- <font color = green>[src]Logged in for the first time."
> usr.loc = locate(1,1,2)
> Save()
> if("Sub-Zero")
> icon = 'Sub zero.dmi'
> icon_state = "subzero"
> world << "<font color=gray size=2> -SERVER INFO- <font color = green>[src]Logged in for the first time."
> usr.loc = locate(1,1,2)
> Save()
> Logout()
> if(cansave)
> Save()
> world << "<font color=gray size2> -SERVER INFO- <font color = green> [src] has logged out of Armageddon."
> ..()
> del(src)
>
>
>
> Load_Kombatant
> icon = 'Load Kombatant.png'
> Click()
> var/savefile/F=new("saves[rsc.key].sav")
> cansave = 1
> Read(F)
> var/lx,ly,lz
> F["last_x"] >> lx
> F["last_y"] >> ly
> F["last_z"] >> lz
> loc = locate(lx,ly,lz)
> world << "<font color=gray size=2> -SERVER INFO- <font color = green>[src] Has re-joined Armageddon."
> Save()
>
>
> Quit_Kombatant
> icon = 'Quit Kombatant.png'
> Click()
> var/savefile/F = new("saves/[src.key].sav")
> Write(F)
> F["last_x"] << x//Writes over their last with their new one.
> F["last_y"] << y
> F["last_z"] << z
> src << "<font color=gray size2> -USER INFO- <font color =green> <font color = orange>Your game has been saved!"
> Save()
> ..()



As far as I can tell that should be it, Im at college so I can't compile and test it.
In response to Dice1989
no it wasnt it. i got 12 erorrs.
In response to Dbgtsuperfreak
Alright, I see what your trying to do now. First off define your procs.

mob
proc
ChooseCharacter()
src.name = input("Please name your kombatant. ","Name input")
switch(input("Please choose your kombatant.") in list("Scorpion","Sub-Zero"))
if("Scorpion")
icon = 'Scorpion.dmi'
icon_state = "scorpion"
world << "<font color=gray size=2> -SERVER INFO- <font color = green>[src]Logged in for the first time."
usr.loc = locate(1,1,2)
Save()
if("Sub-Zero")
icon = 'Sub zero.dmi'
icon_state = "subzero"
world << "<font color=gray size=2> -SERVER INFO- <font color = green>[src]Logged in for the first time."
usr.loc = locate(1,1,2)
Save()
Save()
var/savefile/F = new("saves/[src.key].sav")
Write(F)
F["last_x"] << x//Writes over their last with their new one.
F["last_y"] << y
F["last_z"] << z
src << "<font color=gray size2> -USER INFO- <font color =green> <font color = orange>Your game has been saved!"
..()
Load()
var/savefile/F=new("saves[rsc.key].sav")
cansave = 1
Read(F)
var/lx,ly,lz
F["last_x"] >> lx
F["last_y"] >> ly
F["last_z"] >> lz
loc = locate(lx,ly,lz)
world << "<font color=gray size=2> -SERVER INFO- <font color = green>[src] Has re-joined Armageddon."

Logout()
if(cansave)
Save()
world << "<font color=gray size2> -SERVER INFO- <font color = green> [src] has logged out of Armageddon."
..()
del(src)


Then add in your buttons.

turf/Tittl_screen
Tittle_Screen
icon = 'MKALogin.png'

Create_Kombatant
icon = 'Create Kombatant.png'
Click()
ChooseCharacter()

Load_Kombatant
icon = 'Load Kombatant.png'
Click()
Load()

Quit_Kombatant
icon = 'Quit Kombatant.png'
Click()
del(src)


I hope that works, or at least helps you, also I don't think you wanted to be calling the Save() proc when they hit "Quit".
In response to Dice1989
I tried several differnt things with that code and nothing worked. Can somon please help me figure out what is wrong?
In response to Dbgtsuperfreak
Look for "error:: Inconsistent indentation." (Mainly the example 2 of it)

That's the reason why most people donm't copy/paste (just stating, not accusing you of doing it).

- GhostAnime
In response to GhostAnime
I finally fixed that error but once I did I got 4 more

Tittle Screen\Tittle screen.dm:27:error:rsc.key:undefined var
Tittle Screen\Tittle screen.dm:46:error:ChooseCharacter:undefined proc
Tittle Screen\Tittle screen.dm:51:error:Load:undefined proc
Tittle Screen\Tittle screen.dm:6::warning: empty switch statement
In response to Dbgtsuperfreak
Exactly what the error says now, fix em up.

Error 1: src not rsc :O

Error 2+3: proc does not exist, make sure you are calling it from the right thing (eg: mob.Proc() not turf.Proc() if it's mob/proc/Proc())

Error 4 is described here

It is NOT unusual for errors/warnings to show up after certain other errors/warnings (as some basically hides them in the crowd or is considered not important compared to the previous ones)

- GhostAnime
In response to GhostAnime
I was able to fix the warning and #1 but those proc ones have me confuzzled. I have called them correctly but i cant fix them.

Code:
mob
proc
ChooseCharacter()
src.name = input("Please name your kombatant. ","Name input")
switch(input("Please choose your kombatant.") in list("Scorpion","Sub-Zero"))
if("Scorpion")
icon = 'Scorpion.dmi'
icon_state = "scorpion"
world << "<font color=gray size=2> -SERVER INFO- <font color = green>[src]Logged in for the first time."
usr.loc = locate(1,1,2)
Save()
if("Sub-Zero")
icon = 'Sub zero.dmi'
icon_state = "subzero"
world << "<font color=gray size=2> -SERVER INFO- <font color = green>[src]Logged in for the first time."
usr.loc = locate(1,1,2)
Save()
Save()
var/savefile/F = new("saves/[src.key].sav")
Write(F)
F["last_x"] << x//Writes over their last with their new one.
F["last_y"] << y
F["last_z"] << z
src << "<font color=gray size2> -USER INFO- <font color =green> <font color = orange>Your game has been saved!"
..()
Load()
var/savefile/F=new("saves[rsc.key].sav")
cansave = 1
Read(F)
var/lx,ly,lz
F["last_x"] >> lx
F["last_y"] >> ly
F["last_z"] >> lz
loc = locate(lx,ly,lz)
world << "<font color=gray size=2> -SERVER INFO- <font color = green>[src] Has re-joined Armageddon."



turf/Tittl_screen
Tittle_Screen
icon = 'MKALogin.png'

Create_Kombatant
icon = 'Create Kombatant.png'
Click()
ChooseCharacter()

Load_Kombatant
icon = 'Load Kombatant.png'
Click()
Load()

Quit_Kombatant
icon = 'Quit Kombatant.png'
Click()
del(src)




var
cansave
savefile


//Tittle Screen\Tittle //screen.dm:27:error:rsc.key:undefined var
//Tittle Screen\Tittle //screen.dm:46:error:ChooseCharacter:undefined proc
//Tittle Screen\Tittle screen.dm:51:error:Load:undefined proc
In response to Dbgtsuperfreak
1) I see a rsc.key there still, it should be src.key (src not rsc)

2)
turf/Tittl_screen
Tittle_Screen
icon = 'MKALogin.png'

Create_Kombatant
icon = 'Create Kombatant.png'
Click()
ChooseCharacter()

Load_Kombatant
icon = 'Load Kombatant.png'
Click()
Load()


The problem is.. you are calling the proc from the wrong source.

If you have nothing before the proc (X not there in X.proc(), meaning proc() itself), than it'll default to src (src.proc(). Src = source which is why you are getting the error.

Still don't understand? src for Load() =
turf/Tittl_screen/Load_Kombatant (as it contains that proc... btw,it's spelt title), the procs are mob/proc, meaning that the src doesn't have it. Make the procs refer to a mob, which in this case should be usr. (so in short, add usr. in front of those procs like usr.Load())

- GhostAnime
In response to GhostAnime
Ghost I know you are trying to help me but I just dont get what you are exsplaing. I already had fixed the rsc. thing. I am just getting 2 unidentified procs and I tired everything you told me to fix it but I can't seem to get it to work. Please post the fixed and corrected code. I really don't like people just giving me codes but in this case I really need you do. So if can fix it and post the fixed code here I would grretly appreciate it.
In response to Dbgtsuperfreak
usr.Load()
usr.ChooseCharacter() (or whatever that proc was)

Because you were missing the "usr." for those procs under the Click(), it assumed the proc to be "src.Load()" etc... now remember, src is a TURF, usr is a MOB (well, unless you warp the code around) and the procs were defined under mob/proc which is why it gave you the error (since it was defined as src._(), it couldn't find it in the turf/proc thus the error)

- GhostAnime
In response to GhostAnime
Thank you Ghost for keeping up with me. It finally work. Thank again for helping me.
In response to Dbgtsuperfreak
No problem >_>

- GhostAnime