ID:148169
 
While working on some new project, that's easy enough for me to actually finish in a week or so, I came upon an error.
So far, it's very new, and only has a LITTLE bit of code.
Anyways, here's the code. Remember, this is all I've made so far.

mob
New()
..()
src.x = 6
src.y = 6
src.z = 1
usr << "Creating ship...."
var/power = 15
Restart
var/weapons = input("How much power do you want to put into your weapons? ([power] points available)","Character Creation") as num
if (weapons > power)
alert("You can only put up to [power] points into weapons!","Character Creation")
goto Restart
else
power -= weapons
weapons += 1
alert("You have a weapon strenth of [weapons]. (Added +1 for safety reasons.)","Character Creation")
Engine
var/engine = input("How much power do you want to put into your engines? ([power] points available)","Character Creation") as num
if (engine > power)
alert("You can only put up to [power] points into engines!","Character Creation")
goto Engine
else
engine += 1
alert("You have an engine strenth of [engine]. (Added +1 for safety reasons.)","Character Creation")
Armor
var/armor = input("How much power do you want to put into your armor? ([power] points available)","Character Creation") as num
if (engine > power)
alert("You can only put up to [power] points into armor!","Character Creation")
goto Armor
else
armor += 1
alert("You have an armor strenth of [armor]. (Added +1 for safety reasons.)","Character Creation")
var/startover = input("You have [armor] armor points, [engine] engine points, and [weapons] weapon points. You have [power] point\s left. Accept this ship?", "Character Creation", "Yes", "No")
if (startover == "No")
power = 15
goto Restart


And here's the error.

runtime error: bad client
proc name: New (/mob/New)
source file: Space Battles.dm,10
usr: the mob (/mob)
src: the mob (/mob)
call stack:
the mob (/mob): New()
You're trying to display input() dialogs to NPCs. Won't work. =)

Just put in an if(client) check in, to make it only execute for human players.
Ack! This is a very bad use of goto--don't do it.

Instead, replace it with a while(1) loop; indent everything under it that's supposed to repeat. Every time something calls "goto Restart", put in "continue" instead. And as the last line in the loop, put in "break".

Lummox JR