verb/Text_Export()
set category = null
set desc = "Export Cards to a Text File"
if(!usr.custom_cards.len)
usr << "CARD EXPORT ERROR: No cards to export."
return
var/output = ""
output += "<CUSTOM>\n\n"
var/ico_yn = input("Do you also want to create a compiled icon of your cards?\n\n\nNote: Doing so will reformat the icon state names of your cards.","Custom Card Icon") as null|anything in list("Yes","No")
var/icon/final_icon = new
for(var/obj/custom_card/CC in usr.custom_cards)
if(!CC.template_card) continue
var/obj/cards/C = CC.template_card
output += "<CARD>\n"
var/c_type = ""
if(istype(C,/obj/cards/monster))
if(!isnull(C.pendulum))
if(C.xyz) c_type = "XP"
else if(C.synchro) c_type = "SP"
else if(C.fusion) c_type = "FP"
else c_type = "NP"
else
if(C.ritual) c_type = "R"
else if(C.fusion) c_type = "F"
else if(C.synchro)
if(C.dsync) c_type = "DS"
else c_type = "S"
else if(C.xyz) c_type = "X"
else if(C.link) c_type = "L"
else c_type = "N"
else if(istype(C,/obj/cards/spell))
c_type = "M"
else
c_type = "T"
if(CC.custom_global) output += "<GLOBAL>1</GLOBAL>\n"
output += "<CARD_TYPE>[c_type]</CARD_TYPE>\n"
output += "<NAME>[C.name]</NAME>\n"
var/tmp_icon_state = "[C.icon_state]"
if(ico_yn == "Yes")
tmp_icon_state = "[C.name]"
tmp_icon_state = dd_replacetextUD(output," ","_")
output += "<ICON_STATE>[tmp_icon_state]</ICON_STATE>\n"
output += "<ATTRIBUTE>[C.attrib]</ATTRIBUTE>\n"
if(c_type != "M" && c_type != "T")
if(C.xyz)
output += "<RANK>[C.rank]</RANK>\n"
else if(C.link)
var/l_output = ""
if(C.link_n) l_output += "*N*"
if(C.link_s) l_output += "*S*"
if(C.link_e) l_output += "*E*"
if(C.link_w) l_output += "*W*"
if(C.link_ne) l_output += "*NE*"
if(C.link_nw) l_output += "*NW*"
if(C.link_se) l_output += "*SE*"
if(C.link_sw) l_output += "*SW*"
output += "<LINK>[l_output]</LINK>\n"
else
output += "<LEVEL>[C.level]</LEVEL>\n"
if(!isnull(C.pendulum))
output += "<SCALE>[C.scale_b]</SCALE>\n"
output += "<TYPE>[C.stype]</TYPE>\n"
if(!isnull(C.pendulum))
output += "<PENDULUM>[C.pendulum]</PENDULUM>\n"
output += "<DESCRIPTION>[C.desc]</DESCRIPTION>\n"
if(c_type != "M" && c_type != "T")
output += "<ATK>[C.atk]</ATK>\n"
if(!C.link)
output += "<DEF>[C.def]</DEF>\n"
if(c_type == "N") if(C.maximum)
output += "<MAXIMUM>1</MAXIMUM>\n"
if(C.max_atk)
output += "<MAX_ATK>[C.max_atk]</MAX_ATK>\n"
output += "<EFFECT>[C.effect]</EFFECT>\n"
if(C.tuner) if(!C.xyz) if(!C.link)
if(C.dsync)
output += "<TUNER>2</TUNER>\n"
else
output += "<TUNER>1</TUNER>\n"
if(C.armor) output += "<ABILITY>Armor</ABILITY>\n"
else if(C.flip) output += "<ABILITY>Flip</ABILITY>\n"
else if(C.gemini) output += "<ABILITY>Gemini</ABILITY>\n"
else if(C.spirit) output += "<ABILITY>Spirit</ABILITY>\n"
else if(C.toon) output += "<ABILITY>Toon</ABILITY>\n"
else if(C.union) output += "<ABILITY>Union</ABILITY>\n"
if(c_type == "M")
if(C.attrib == "Link")
var/l_output = ""
if(C.link_n) l_output += "*N*"
if(C.link_ne) l_output += "*NE*"
if(C.link_nw) l_output += "*NW*"
output += "<LINK>[l_output]</LINK>\n"
output += "</CARD>\n\n"
var/icon/work_blank = icon(C.icon)
var/state_choice_blank = "[C.icon_state]"
for(var/state in work_blank.IconStates())
if(state == "[state_choice_blank]")
final_icon.Insert(icon(work_blank, state), state == "[state_choice_blank]" ? "[tmp_icon_state]" : state,,1)
output += "</CUSTOM>"
fdel("[usr.ckey]_temp_txt.txt")
text2file(output,"[usr.ckey]_temp_txt.txt")
usr << ftp("[usr.ckey]_temp_txt.txt","Custom Card List.txt")
if(ico_yn == "Yes")
usr << ftp(final_icon,"[usr.key]_Custom_Card_Pack.dmi")
return
Problem description:
Working on a new proc here. I'm getting a hard crash on that final usr << ftp line, i'm not sure why. I've used it in the same way in other procs and it works just fine, but I'm getting a crash on this one.
Purpose of this verb is to take a series of obj that the user has in their list/custom_cards var.
Break down all of their stats in to a string and export that string to a readable txt file that can be manipulated and imported at a later time if the player needs to.
That portion works fine but...
It also gives the player an option to export the icons of their objs. Each of the objs can have their icons set individually when they're created, so they can have different icons being used.
This is SUPPOSE to take all of the icons of those objs, extract just the state that the obj is using, rename it to the name of the card, and insert it in to a new icon, and then let the player download it.
When it gets to the FTP line for the icon though, it just hard crashes.
Am I overlooking something here?