ID:168141
 
I'm new to coding, so I thought as practice I'd make a game similar to Morning Star Inn, but I'm running into many problems with coding. I was wondering if anyone could show me how to make a customizable verb, like description, name, equipment, etc. that you can change at any time. Any help would be greatly appreciated. *Sorry in advance if this has been posted and answered a hundred times already
mob/var
weapon // make a weapon var
mob/verb/Customize()
switch(input(usr,"What do you wish to customize?","Customize") in list ("Weapon","Shield","...")//Choose what to customize
if("Weapon")//If it's a weapon
usr.weapon = input("Name your weapon","Customize") as text // Input a description as text

mob/verb/Look(mob/M)
usr<<"[M.weapon]" // says the players weapon
In response to Mysame
There is no need to specify the recipient of the input() in that verb, it defaults to usr.

To add a cancel option to an input directly on the outlining of the input menu, just do as null|anything in list.

Oh, and you should give them a cancel option should they decide they don't want to enter anything yet, by using as null|text.
In response to Mysame
Mysame wrote:
> mob/var
> weapon // make a weapon var
> mob/verb/Customize()
> switch(input(usr,"What do you wish to customize?","Customize") in list ("Weapon","Shield","...")//Choose what to customize
> if("Weapon")//If it's a weapon
> usr.weapon = input("Name your weapon","Customize") as text // Input a description as text
>
> mob/verb/Look(mob/M)
> usr<<"[M.weapon]" // says the players weapon

I'm having a problem in the line
if("Weapon")

It gives me the error
if: missing comma ',' or right-paren ')'
I'm unsure how to fix that.
In response to Raynar
When you get errors relating to braces, it's often the line above the line the compiler tells you (not to say that that's always this case).

But lesson 1, don't copy and paste off the forums. Look at what you're shown. Then read it. Then learn it by reading it again and looking at the details. And then make it YOURSELF without looking at the forums.

The actual problem is with this line:

switch(input(usr,"What do you wish to customize?","Customize") in list ("Weapon","Shield","...")

Count up how many "(" you get.

3 right?

Count up how many ")" you get.

2 right?

See the problem? We need to add another ")" - the one to close off the switch().

By the way, don't try making a game. Start small. Read the DM Guide and then learn it. Make systems and your own processes rather than a game as you learn.
In response to DeathAwaitsU
I didn't plan on completely copying and pasting, but I was first running it to see how it actually worked in game, then basing my own code on it.(still not fully understanding it all)
As for my "game", I didn't plan on publishing this one, but running it on my own to see how everything works together.
Anyhoo, thanks for helping all.
In response to Raynar
If you're not fully understanding it, read the entire DM Guide. Front to back. Seriously, that's all you need. If you do it properly, you'd be a good programmer.

As for this particular case, look up every proc involved in the code in the DM Reference (hit F1 in Dream Maker). If you're still not getting it, ask specific questions. Not vague ones.