ID:174795
 
ok, heres my code:
BLAH
        char_hp=input("how much hp do you want?")as null|text
if(char_hp<"4")
usr<<"sorry thats too much, small, or is not a number! it will be set to 12!"
char_hp=12
which works, but i want it to be:
BLAH
        char_hp=input("how much hp do you want?")as null|text
if(char_hp<"4")
usr<<"sorry thats too much, small, or is not a number! it will be set to 12!"
char_hp=12//<---line76 in LOGIN.dm
if(char_hp>"15")
usr<<"sorry thats too much, small, or is not a number! it will be set to 12!"
char_hp=12

but whenever i try that it gives me this runtime error:
runtime error: type mismatch
proc name: CreateCharacter (/mob/creating_character/proc/CreateCharacter)
source file: LOGIN.dm,76
usr: Redslash (/mob/creating_character)
src: Redslash (/mob/creating_character)
call stack:
Redslash (/mob/creating_character): CreateCharacter()
Redslash (/mob/creating_character): Login()

and i don't know what it means, plz help
Redslash wrote:
ok, heres my code:
BLAH
>       char_hp=input("how much hp do you want?")as null|text
> if(char_hp<"4")
> usr<<"sorry thats too much, small, or is not a number! it will be set to 12!"
> char_hp=12
>
which works, but i want it to be:
BLAH
>       char_hp=input("how much hp do you want?")as null|text
> if(char_hp<"4")
> usr<<"sorry thats too much, small, or is not a number! it will be set to 12!"
> char_hp=12//<---line76 in LOGIN.dm
> if(char_hp>"15")
> usr<<"sorry thats too much, small, or is not a number! it will be set to 12!"
> char_hp=12
>


Well, first off, why are you using text input for an HP var? You should set it as num|null or null|num. How can you use > and < comparing a text input?

Second off, Im sorry, but I don't know what the run-time error means. It says type mismatch, maybe it's because your using text.


Airjoe
In response to Airjoe
well, num|null realy helps, thx! now they have to set it as a number, but it still gives me the same run time error. oh yeah and the run time error happens after i put in the hp value. i think it has some thing to do with the 2 ifs, not sure tho...
In response to Redslash
run time error is an error that happens while your running the program, usually it happens when you use refer to atoms that have been deleted in your code

And sorry, I cant help you unless I know exacly what the run-time error says, if it says anything
In response to FranquiBoy
-_-'

He already posted the run-time error. And he didn't want to know the definition of run-time error. He wanted to know what his meant.

<-Airjoe->
For stuff like if(char_hp<"4") make it if(char_hp<4). IE: remove the quotes. They're for strings(text), not numbers.
In response to Airjoe
well i was messing with my code some more and tried this:
        char_hp=input("how much hp do you want?")as num|null
/* if(char_hp<"4")
usr<<"sorry thats too much, small, or is not a number! it will be set to 12!"
char_hp=12*/

if(char_hp>"15")
usr<<"sorry thats too much, small, or is not a number! it will be set to 12!"
char_hp=12

and it poped up with the same runtime error. now im really confused :? i thought it was because of the 2 ifs, WHATS GOING ON?!?!?!?! *run around in circles screaming*
In response to Redslash
You're still using "4" and "15". just use 4 and 15
In response to Jon88
THZNK YOU!!! it worked! i didn't relize it was 2 simple "" that could ruin my dream, thanks so much!
In response to Redslash
*mumbles: mumble after what I did mumble for him....I helped him first...mumble mumble i said the ""s too mumble*

=P

<-Airjoe->