Index · Preferences · Help
Announcements · BYOND Features · Bug Reports · Fixes and Features · Developer How-To · Code Problems · Design Philosophy · Creations · Classified Ads · Gaming · Computers & Technology · Community
Forum Search:

[Advanced Search]

[Messages in this Thread] [Show All (2)] [Return to Developer How-To]

Author:Strong123488 [Posts]
Date:11/8/09 3:15 am
Topic:How do I make this code more efficient?
Post ID:726250
Next ID:726257
mob/var/list
    Elements = list("Katon"=0, "Fuuton"=0, "Raiton"=0, "Doton"=0, "Suiton"=0)

obj/elements
    icon = 'images/elements/chakraElements.dmi'
    fireimg
        icon_state = "fire"
        name = "Katon"
    windimg
        icon_state = "wind"
        name = "Fuuton"
    lightningimg
        icon_state = "lightning"
        name = "Raiton"
    earthimg
        icon_state = "earth"
        name = "Doton"
    waterimg
        icon_state = "water"
        name = "Suiton"
        
        

mob/Stat()
    statpanel("Status")
    stat(src)
    for(var/obj/elements/E in contents)
        stat(E)
    

mob/proc/UPDATESTAT()
    var/obj/elements/fireimg/F = new()
    F.suffix = "                  [src.Elements["Katon"]]"
    src.contents += F
    
    var/obj/elements/windimg/W = new()
    W.suffix = "                  [src.Elements["Fuuton"]]"
    src.contents += W
    
    var/obj/elements/lightningimg/L = new()
    L.suffix = "                  [src.Elements["Raiton"]]"
    src.contents += L
    
    var/obj/elements/earthimg/E = new()
    E.suffix = "                  [src.Elements["Doton"]]"
    src.contents += E
    
    var/obj/elements/waterimg/WA = new()
    WA.suffix = "                  [src.Elements["Suiton"]]"
    src.contents += WA

Basically due to the limitation of the stat() proc, I had to use suffixes to get the numbers I wanted to display to the right of the image. So, how would I go about making this terrible code more efficient?

Messages in this Thread: [Show All (2)]

  How do I make this code more efficient? Strong123488 (11/8/09 3:15 am)
      Re: How do I make this code more efficient? Metamorphman (11/8/09 5:26 am)