runtime error: bad icon operation
proc name: Insert (/icon/proc/Insert)
usr: IceFire2050 (/mob)
src: /icon (/icon)
usr.loc: (41,129,1) (/turf/FLOOR/ROAD)
call stack:
/icon (/icon): Insert(/icon (/icon), "", 2, 1, null, null)
IceFire2050 (/mob): Number Overlay Test()
Code:
Number_Icon_Test()
set category = "Testing"
var/obj/number_overlay/number = new
var/obj/number_overlay/grow_a1 = new
var/obj/number_overlay/grow_a2 = new
var/obj/number_overlay/grow_a3 = new
var/obj/number_overlay/grow_b1 = new
var/obj/number_overlay/grow_b2 = new
var/obj/number_overlay/grow_b3 = new
var/obj/number_overlay/grow_c1 = new
var/obj/number_overlay/grow_c2 = new
var/obj/number_overlay/grow_c3 = new
var/obj/number_overlay/number_c = new
var/obj/number_overlay/c_glow = new
//Icons to work on
var/icon/i_b = new
var/icon/i_o = new
var/icon/i_i = new
var/icon/i_b2 = new
var/icon/i_o2 = new
var/icon/i_i2 = new
var/icon/i_b3 = new
var/icon/i_o3 = new
var/icon/i_i3 = new
var/icon/i_b4 = new
var/icon/i_o4 = new
var/icon/i_i4 = new
//Chaos
var/icon/i_c1 = new
var/icon/i_c2 = new
var/icon/i_c3 = new
var/icon/i_c4 = new
var/icon/i_c5 = new
var/icon/i_bx = icon('number_overlay.dmi')
var/icon/i_ox = icon('number_overlay_o.dmi')
var/icon/i_ix = icon('number_overlay_i.dmi')
var/icon/i_chaos = icon('number_overlay_chaos.dmi')
var/R1 = 255
var/G1 = 255
var/B1 = 255
var/R2 = 255
var/G2 = 0
var/B2 = 0
var/istate = ""
var/istate2 = ""
var/istate3 = ""
var/istate4 = ""
var/text_input = input("Enter a Number name","Number Select") as text
var/number_string = ""
var/number_rank = ""
var/num_end = 0
if(findtext(text_input,":"))
num_end = findtext(text_input,":")
number_string = copytext(text_input,8,num_end)
if(findtext(number_string,"iC"))
number_rank = "iC"
number_string = dd_replacetextUD(number_string,"iC","")
if(findtext(number_string,"C"))
number_rank = "C"
number_string = dd_replacetextUD(number_string,"C","")
if(findtext(number_string,"S"))
number_rank = "S"
number_string = dd_replacetextUD(number_string,"S","")
if(findtext(number_string,"F"))
number_rank = "F"
number_string = dd_replacetextUD(number_string,"F","")
if(number_string)
istate = copytext(number_string,1,2)
number_string = copytext(number_string,2,length(number_string)+1)
if(number_string)
istate2 = copytext(number_string,1,2)
number_string = copytext(number_string,2,length(number_string)+1)
if(number_string)
istate3 = copytext(number_string,1,2)
number_string = copytext(number_string,2,length(number_string)+1)
if(number_string)
istate4 = copytext(number_string,1,2)
number_string = copytext(number_string,2,length(number_string)+1)
if(!istate2)
istate2 = istate
istate = "0"
for(var/state in i_bx.IconStates())
if(state == "[istate]")
i_b.Insert(icon(i_bx, state), state == "[istate]" ? "" : state,SOUTH,1)
if(state == "[istate2]")
i_b2.Insert(icon(i_bx, state), state == "[istate2]" ? "" : state,SOUTH,1)
if(istate3)
if(state == "[istate3]")
i_b3.Insert(icon(i_bx, state), state == "[istate3]" ? "" : state,SOUTH,1)
if(istate4)
if(state == "[istate4]")
i_b4.Insert(icon(i_bx, state), state == "[istate4]" ? "" : state,SOUTH,1)
Problem description:
This is only a portion of the code but I'm getting the errors at the insert lines at that point.
It's eventually going to be fed strings of text by another proc, but for testing right now, it asks for an input.
The strings are always going to be in the format of...
"Number 17: Leviathan Dragon"
"Number 39: Utopia"
"Number C96: Dark Storm"
"Number S0: Utopic ZEXAL"
The code takes the string input...
-Removes all text from the string past the colon
-Removes the "Number " from the beginning leaving us with just a string of numbers or possibly 1 letter and a number.
-If the first character is a letter, it gets trimmed out and stored in a seperate var for later use.
-Turns each digit of the number in to its own individual string, up to a possible 4 digits.
-If the Number is single digit, its moved to the second var and a "0" is put in the first var. (Turns 5 in to 05)
Then it looks in the 3 icons provided 'number_overlay.dmi','number_overlay_i.dmi', and 'number_overlay_o.dmi' (stored as i_bx, i_ox, and i_ix) at their states...
-If the state matches one of the digits of the number previously extracted...
-It takes just the state in that file that matches the number and inserts that state in to a new icon based on its digit position (i_b, i_b2, i_b3, and i_b4) and renames it to a blank icon state.
This code WAS working earlier, but i've been working on it all day and after some recent modifications it seems to have stopped working. I cant figure out why, I must have changed something here without remembering it, but I cant find the problem. I use similar code like this for something else in the game and it works fine there.
For clarification... the 3 icons listed are icons with states named "0" , "1", "2", "3", etc etc up to "9".
I get errors on the insert lines. Not sure why, can anyone else help me with a 2nd set of eyes?