call stack:
Valderalgx (/mob/creating_character): Stat()
runtime error: Undefined operation
proc name: Stat (/mob/Stat)
usr: Valderalgx (/mob/creating_character)
src: Valderalgx (/mob/creating_character)
Ok, how do fix this? It keeps going starting when i log on to create a new character and doesn't stop until the game shuts down from too many erors??? Do you need to see my code to help me fix this?
ID:150392
![]() Oct 7 2001, 2:18 am
|
|
![]() Oct 7 2001, 2:32 am
|
|
It might just be me, but I have a sneaking suspicion that there is an undefined operation in a proc named stat().
|
Lord of Water wrote:
It might just be me, but I have a sneaking suspicion that you might have an undefined operation in a proc named stat().So you're saying that I have a Proc named stat? How would I fix that don't I have to have that to show the user stats? |
Valderalgx wrote:
call stack: I'm afraid I'm gonna have to hit you with a "Duh!" here. "Undefined operation" doesn't tell anyone enough about the error for them to be able to guess what it is. It might, however, give them an idea of where to look within the code. So yes, you have to post the code. Lummox JR |
Post your Stat() code.
My guess is that you tried to do something along the lines of multiplying text. -AbyssDragon |
Lummox JR wrote:
Valderalgx wrote: Ok here it is mob var obj/meter/health_meter obj/meter/ki_meter health max_health ki max_ki PowerLevel Health Zeni defence strength Exp=0 MaxExp=100 New() ..() src.health_meter = new src.ki_meter = new Stat() //calculate each meters' number (as a percentage of the total icon_states) src.health_meter.num = (src.health/src.max_health)*src.health_meter.width src.ki_meter.num = (src.ki/src.max_ki)*src.ki_meter.width //update the meters to take on the new changes src.health_meter.Update() src.ki_meter.Update() //change the meters' names to reflect the current numbers src.health_meter.name = "[src.health]/[src.max_health]" src.ki_meter.name = "[src.ki]/[src.max_ki]" //alternatively, change their names to nothing //comment out the above name changes and uncomment the below ones to use this method //src.health_meter.name = "" //src.magic_meter.name = "" statpanel("Stats") //switch to the "Stats" statpanel stat("Health:",src.health_meter) //output the health meter stat("Ki:",src.ki_meter) //output the magic meter stat("PowerLevel",src.PowerLevel) stat("Strength",src.strength) stat("Defence",src.defence) stat("Zeni",src.Zeni) statpanel("Inventory") stat(contents) obj/meter icon = 'meter.dmi' icon_state = "0" //that's zero, not ( ) or O var/num = 0 //the current unrounded icon_state number var/width = 30 //If you have icon_states from "0" to "30" within your // meter.dmi file (i.e. you have 31 icon_states in total), // use this number as it is. //Change it if you have any other number of states; // if you have states from "0" to "5", this number would // be 5 instead. proc/Update() if(num < 0) //if the meter is negative num = 0 //set it to zero else if(num > width) //if the meter is over 100% num = width //set it to 100% src.icon_state = "[round(src.num)]" |
The only problem that stands out to me is that most of your variables appear to be undefined. src.health and src.max_health have no values associated with them; they should be initialized to numbers. My guess is that the lines that set meter.num are trying to do multiplication and division with null values, so in essence you have src.health_meter.num=(null/null)*null. Instant chaos.
Lummox JR |
Lummox JR wrote:
The only problem that stands out to me is that most of your variables appear to be undefined. src.health and src.max_health have no values associated with them; they should be initialized to numbers. My guess is that the lines that set meter.num are trying to do multiplication and division with null values, so in essence you have src.health_meter.num=(null/null)*null. Instant chaos. Yes!!!Fixed it!!!!!!!!I deleted the Health and changed all the Health to health and it worked! Can you explain? |
My guess is that the lines that set meter.num are trying to do multiplication and division with null values, so in essence you have src.health_meter.num=(null/null)*null. Instant chaos. He just did. You can't divide null by null and multiply by null. That makes no sense. =P |