i am makeign a game and i decided to add a start, i have
mob
proc
Begin()
switch(alert(src, "Welcome to [world name]"
var/name = input ("What would you like your name to be?"). as text, null
if(length(name) < 2)
alert("Your name can't be less than two char.s")
return
if(length(name) >20)
alert("Your name can't be larger than thwenty char.s")
return
if(name == src.key)
alert("Your name can't be the same as your key")
return
if(!usr)
return
usr.name="[name]"
"Is this correct?" "Yes" "No"
if "No" return
if "Yes" switch (input("What gender are you?",text) in list ("Male,Female")
if ("Male") usr.icon=(Icon name)
usr.loc. locate (1,1,1)
src.Auto_Save()
sleep(20)
if("Female") usr.icon=(Icon name)
usr.loc locate (1,1,1)
src.Auto_Save()
sleep (20)
BUT it says ther eare errors, when i click the errors, it helps me none and ivecheched EVERYTHING
and it says it is wrong, plz help :(</2>
ID:139065
Jul 19 2011, 11:33 am (Edited on Jul 19 2011, 11:49 am)
|
|
Jul 19 2011, 11:43 am
|
|
compile log,please
|
In response to BeignetLover
|
|
huh? lol im new to this
|
In response to Smilies
|
|
something tells me this code is a direct copy and paste, copy and pasting won't do you any good. Start from scratch, this might help.
|
In response to BeignetLover
|
|
Aye, start over, because that code is screwed up badly. It's much easier to just write your own. It's messed up from the first line after Begin().
|
mob/var This MIGHT help, but something is wrong with the second input line , where you choose your gender, the popup doesn't show, you'll probably have to get another member to help you with THAT, since I'm a beginner as well EDIT: Also, wtf?? 20 characters? That's crazy EDIT EDIT: Oh, nevermind that was the maximum length |
In response to BeignetLover
|
|
There was also the issue of the switch() not doing anything.
|
In response to Lugia319
|
|
Lugia319 wrote:
There was also the issue of the switch() not doing anything. Correct, don't know how to fix it :( Also, to the Original Poster: If you're very new to BYOND programming, I don't think you need to be doing Character Creation, a good start would be just a single-player game with a simple combat system. Or hell, even just a chat room. Good luck with your future projects ;) |
In response to BeignetLover
|
|
Well the alert did absolutely nothing. It didn't offer choices, so there was no point in there being a switch().
|
Lets see what we can do:
switch(alert(src, "Welcome to [world name]" 1) As mentioned previously, switch() is absolutely useless here 2) That is not how you access the name from /world. It should be "world.name" not "world name". var/name = input ("What would you like your name to be?"). as text, null if(!usr) usr is safe in procedures where it is directly called (ex: Click(), DblClick()). Instead of usr, you should use src here since the src will be the /mob which invoked this procedure. "Is this correct?" "Yes" "No" If you did not take a look at the Get Started article, I highly suggest you do... because the above syntax does not exist in BYOND. That should be a switch(input(...) as list) OR, more useful, should be a simple if() statement with an alert if(alert(...) == "Yes") if ("Male") usr.icon=(Icon name) That is an incorrect way to define an icon as the syntax is wrong. Use the icon() procedure if the file name is dynamic or, more useful, set the icon to its appropriate file (icon = 'file.dmi). And you cannot set the loc like that, you need to define it clearly with = Not to mention that if you have an if() followed by a statement after the right parenthesis ), it is treated as a single-line if() statement. Also, you can note some redundancy in the two if() statements, specifically the last two line. What you can do is move those three lines OUT of the if() at the end, which will be called by both choices after the if() is done BUT it says ther eare errors, when i click the errors, it helps me none and ivecheched EVERYTHING To sum up your problems: you are using the wrong syntax while programming in DM. If you have not dnoe so, I suggest you start learning the DM way with the Get Started article ^_^ |
In response to GhostAnime
|
|
I learned DM from Downloading stuff from "resources". It's easier to learn more advanced stuff that way
|