Register to post in forums, or Log in to your existing account
 

Play RetroMUD
Post new topic  Reply to topic     Home » Forums » CMUD Beta Forum
jed
Adept


Joined: 18 Dec 2005
Posts: 246

PostPosted: Mon Jun 04, 2007 2:01 am   

[1.33] Reformat Script changes #if Statements and highlighting
 
I just ran a reformat on one script of
Code:
#if (@item.hit = {}) {#say "hit is empty"} {
  $temphit = %concat(" ",{@item.hit},"hit")
  }
#if (@item.dam = {}) {#say "dam is empty"} {
  $tempdam = %concat(" ",{@item.dam},"dam")
  }
  #if (@item.ac = {}) {#say "AC is empty"} {
  $tempac = %concat(" ",{@item.ac},"AC")
  }
#if (@item.minlevel = {}) {#say "minlevel is empty"} {
  $tempminlevel = %concat( {@item.minlevel}, L)
  }
#if (@item.wearloc = {}) {#say "wearloc is empty"} {
  $tempwearloc = %concat(" ",{@item.wearloc})
  }
#if (@item.wearloc = "weapon") {#if (@item.weight = {}) {#say "weight is empty"} {
  $tempweight = %concat(" ",{@item.weight},"W")
  } {}
  }
#if (@item.dex = {}) {#say "dex is empty"} {
  $tempdex = %concat(" ",{@item.dex},"Dex")
  }
#if (@item.int = {}) {#say "int is empty"} {
  $tempintgos  = %concat(" ",{@item.int},"Int")
  }
#if (@item.str = {}) {#say "str is empty"} {
  $tempstr = %concat(" ",{@item.str},"Str")
  }
#if (@item.con = {}) {#say "con is empty"} {
  $tempcon = %concat(" ",{@item.con},"Con")
  }
#if (@item.wis = {}) {#say "wis is empty"} {
  $tempwis = %concat(" ",{@item.wis},"Wis")
  }
#if (@item.hp = {}) {#say "hp is empty"} {
  $temphp = %concat(" ",{@item.hp},"HP")
  }
#if (@item.mindam = {}) {#say "mindam is empty"} {
  $tempmindam = %concat(" ",{@item.mindam})
  }
#if (@item.maxdam = {}) {#say "maxdam is empty"} {
  $tempmaxdam = %concat(" ",{@item.maxdam},"Maxdam")
  }
#if (@item.avedam = {}) {#say "avedam is empty"} {
  $tempavedam = %concat(" ",{@item.avedam},"avedam")
  }
#if (@item.mv = {}) {#say "mv is empty"} {
  $tempmv = %concat(" ",{@item.mv},"MV")
  }
#if (@item.savevsspell = {}) {#say "SaveVsSpell is empty"} {
  $tempsavevsspell = %concat(" ",{@item.savevsspell},"S vs spell")
  }
#if (@item.mana = {}) {#say "mana is empty"} {
  $tempmana = %concat(" ",{@item.mana},"Mana")
  }
#if (@item.forged = {}) {#say "forged is empty"} {
  $tempforged = %concat(" ",{@item.forged},"forged")
  }
#if (@item.barsqtyforged = {}) {#say "barsqtyforged is empty"} {
  $tempbarsqtyforged = %concat(" ",{@item.barsqtyforged},"Frg Bars")
  }
#if (@item.affect1 = {}) {#say "affect1 is empty"} {
  $tempaffect1 = %concat(" ","(",{@item.affect1},")")
  }
#if (@item.affect2 = {}) {#say "affect2 is empty"} {
  $tempaffect2 = %concat(" ","(",{@item.affect2},")")
  }
#if (@item.affect3 = {}) {#say "affect3 is empty"} {
  $tempaffect3 = %concat(" ","(",{@item.affect3},")")
  }
#if (@item.affect4 = {}) {#say "affect4 is empty"} {
  $tempaffect4 = %concat(" ","(",{@item.affect4},")")
  }
#if (@item.affect5 = {}) {#say "affect5 is empty"} {
  $tempaffect5 = %concat(" ","(",{@item.affect5},")")
  }
#if (@item.affect6 = {}) {#say "affect6 is empty"} {
  $tempaffect6 = %concat(" ","(",{@item.affect6},")")
  }
#if (@item.cpspellpower = {}) {#say "cpspellpower is empty"} {
  $tempcpspellpower = %concat(" ","(",{@item.cpspellpower},")")
  }
#if (@item.cpspell = {}) {#say "cpspell is empty"} {
  $tempcpspell = %concat(" ",{@item.cpspell},"Foci")
  }
#if (@item.scrolllevel = {}) {#say "scrolllevel is empty"} {
  $tempscrolllevel = %concat(" ",{@item.scrolllevel},"ScrLev")
  }
#if (@item.scrollspell = {}) {#say "scrollspell is empty"} {
  $tempscrollspell = %concat(" ","<",{@item.scrollspell},">")
  }
#if (@item.bankable = {}) {#say "bankable is empty"} {
  $tempbankable = %concat(" ","<",{@item.bankable},">")
  }
#if (@item.nosteal = {}) {#say "nosteal is empty"} {
  $tempnosteal = %concat(" ","<",{@item.nosteal},">")
  }
#if (@item.bsweapon = {}) {#say "bsweapon is empty"} {
  $tempbsweapon = " Backstab"
  }
#if (@item.doselevel = {}) {#say "doselevel is empty"} {
  $tempdoselevel = %concat(" ",{@item.doselevel},"Dose Lev")
  }
#if (@item.dosespells = {}) {#say "dosespells is empty"} {
  $tempdosespells = %concat(" ",{@item.dosespells},"Dose SP")
  }
#if (@item.Damtype = {}) {#say "Damtype is empty"} {
  $tempdamtype = %concat(" ",{@item.damtype}," Dam")
  }
#if (@item.chargemax = {}) {#say "chargemax is empty"} {
  $tempmana = %concat(" ",{@item.mana},"Mana")
  }
#if (@item.chargemax = {}) {#say "chargemax is empty"} {
  $tempchargemax = %concat(" ",{@item.chargemax},"Charges")
  }
#if (@item.chargelevel = {}) {#say "chargelevel is empty"} {
  $tempchargelevel = %concat(" ",{@item.chargelevel},"ChargeLev")
  }
#if (@item.chargespell = {}) {#say "chargespell is empty"} {
  $tempchargespell = %concat(" ",{@item.chargespell}," Spell")
  }
#if (@item.minammodam = {}) {#say "minammodam is empty"} {
  $tempminammodam = %concat(" ","(",{@item.minammodam},"-")
  }
#if (@item.maxammodam = {}) {#say "maxammodam is empty"} {
  $tempmaxammodam = %concat({@item.maxammodam},")Dam")
  }
#if (@item.visibility = {}) {#say "visibility is empty"} {
  $tempvisibility = %concat(" ",{@item.visibility})
  }
#if (@item.dropable = {}) {#say "mana is dropable"} {
  $tempdropable = %concat(" ",{@item.dropable})
  }
#if (@item.combinedeffects = {}) {#say "combinedeffects is empty"} {
  $tempcombinedeffects = %concat(" ",{@item.combinedeffects})
  }
#if (@item.cpqty = {}) {#say "cpqty is empty"} {
  $tempcpqty = %concat(" ",{@item.cpqty},"Vol")
  }
#if (@item.norent = {}) {#say "norent is empty"} {
  $tempnorent = %concat(" ","<",{@item.norent},">")
  }
#if (@item.removal = {}) {#say "removal is empty"} {
  $tempremoval = %concat(" ","<",{@item.removal},">")
  }
#if (@item.mana = {}) {#say "mana is empty"} {
  $tempmana = %concat(" ",{@item.mana},"Mana")
  }
#if (@item.ammotype = {}) {#say "ammotype is empty"} {
  $tempammotype = %concat(" ","<",{@item.ammotype},">")
  }
#if (@item.scrollqty = {}) {#say "scrollqty is empty"} {
  $tempscrollqty = %concat(" ",{@item.scrollqty},"Vol")
  }
#if (@item.bpouchqty = {}) {#say "bpouchqty is empty"} {
  $tempbpouchqty = %concat(" ",{@item.bpouchqty},"Vol")
  }
#if (@item.potioncaseqty = {}) {#say "potioncaseqty is empty"} {
  $temppotioncaseqty = %concat(" ",{@item.potioncaseqty},"Vol")
  }
#if (@item.keyringqty = {}) {#say "keyringqty is empty"} {
  $tempkeyringqty = %concat(" ",{@item.keyringqty},"Vol")
  }
#if (@item.shootdammin = {}) {#say "shootdammin is empty"} {
  $tempshootdammin = %concat(" ","(",{@item.shootdammin},"-")
  }
#if (@item.shootdammax = {}) {#say "shootdammax is empty"} {
  $tempshootdammax = %concat({@item.shootdammax},")")
  }
#if (@item.shootdambonus = {}) {#say "shootdambonus is empty"} {
  $tempshootdambonus = %concat(" ",{@item.shootdambonus},"Dam")
  }
#if (@item.maxshootload = {}) {#say "maxshootload is empty"} {
  $tempmaxshootload = %concat(" ",{@item.maxshootload},"MaxLoad")
  }
#if (@item.notake = {}) {#say "notake is empty"} {
  $tempnotake = " <NoTake>"}
    #say %concat( $tempminlevel, $tempaffect1, $tempweight,$tempwearloc,$temphit,$tempdam,$tempac,$tempdex,$tempint,$tempstr,$tempcon,$tempwis,$temphp,$tempmana)

and it turned out like this
Code:

#if (@item.hit = {}) {#say "hit is empty"} {$temphit = %concat( " ", {@item.hit}, "hit")}
#if (@item.dam = {}) { {#say "dam is empty"} {$tempdam = %concat( " ", {@item.dam}, "dam")}
  #if (@item.ac = {}) { {#say "AC is empty"} {$tempac = %concat( " ", {@item.ac}, "AC")}
#if (@item.minlevel = {}) { {#say "minlevel is empty"} {$tempminlevel = %concat( {@item.minlevel}, L)}
#if (@item.wearloc = {}) { {#say "wearloc is empty"} {$tempwearloc = %concat( " ", {@item.wearloc})}
#if (@item.wearloc = "weapon") { {#if (@item.weight = {}) {   {#say "weight is empty"} {
{$tempweight = %concat( " ", {@item.weight}, "W")} {}}
#if (@item.dex = {}) { {#say "dex is empty"} {$tempdex = %concat( " ", {@item.dex}, "Dex")}
#if (@item.int = {}) { {#say "int is empty"} {$tempintgos  = %concat( " ", {@item.int}, "Int")}
#if (@item.str = {}) { {#say "str is empty"} {$tempstr = %concat( " ", {@item.str}, "Str")}
#if (@item.con = {}) { {#say "con is empty"} {$tempcon = %concat( " ", {@item.con}, "Con")}
#if (@item.wis = {}) { {#say "wis is empty"} {$tempwis = %concat( " ", {@item.wis}, "Wis")}
#if (@item.hp = {}) { {#say "hp is empty"} {$temphp = %concat( " ", {@item.hp}, "HP")}
#if (@item.mindam = {}) { {#say "mindam is empty"} {$tempmindam = %concat( " ", {@item.mindam})}
#if (@item.maxdam = {}) { {#say "maxdam is empty"} {$tempmaxdam = %concat( " ", {@item.maxdam}, "Maxdam")}
#if (@item.avedam = {}) { {#say "avedam is empty"} {$tempavedam = %concat( " ", {@item.avedam}, "avedam")}
#i#if@item.mv = {}) { {#say "mv is empty"} {$tempmv = %concat( " ", {@item.mv}, "MV")}
#if (@item.savevsspell = {}) { {#say "SaveVsSpell is empty"} {$tempsavevsspell = %concat( " ", {@item.savevsspell}, "S vs spell")}
#i#if@item.mana = {}) { {#say "mana is empty"} {$tempmana = %concat( " ", {@item.mana}, "Mana")}
#if (@item.forged = {}) { {#say "forged is empty"} {$tempforged = %concat( " ", {@item.forged}, "forged")}
#if (@item.barsqtyforged = {}) { {#say "barsqtyforged is empty"} {$tempbarsqtyforged = %concat( " ", {@item.barsqtyforged}, "Frg Bars")}
#i#if@item.affect1 = {}) { {#say "affect1 is empty"} {$tempaffect1 = %concat( " ", "(", {@item.affect1}, ")")}
#i#if@item.affect2 = {}) { {#say "affect2 is empty"} {$tempaffect2 = %concat( " ", "(", {@item.affect2}, ")")}
#i#if@item.affect3 = {}) { {#say "affect3 is empty"} {$tempaffect3 = %concat( " ", "(", {@item.affect3}, ")")}
#i#if@item.affect4 = {}) { {#say "affect4 is empty"} {$tempaffect4 = %concat( " ", "(", {@item.affect4}, ")")}
#i#if@item.affect5 = {}) { {#say "affect5 is empty"} {$tempaffect5 = %concat( " ", "(", {@item.affect5}, ")")}
#i#if@item.affect6 = {}) { {#say "affect6 is empty"} {$tempaffect6 = %concat( " ", "(", {@item.affect6}, ")")}
#if (@item.cpspellpower = {}) { {#say "cpspellpower is empty"} {$tempcpspellpower = %concat( " ", "(", {@item.cpspellpower}, ")")}
#i#if@item.cpspell = {}) { {#say "cpspell is empty"} {$tempcpspell = %concat( " ", {@item.cpspell}, "Foci")}
#if (@item.scrolllevel = {}) { {#say "scrolllevel is empty"} {$tempscrolllevel = %concat( " ", {@item.scrolllevel}, "ScrLev")}
#if (@item.scrollspell = {}) { {#say "scrollspell is empty"} {$tempscrollspell = %concat( " ", "<", {@item.scrollspell}, ">")}
#i#if@item.bankable = {}) { {#say "bankable is empty"} {$tempbankable = %concat( " ", "<", {@item.bankable}, ">")}
#i#if@item.nosteal = {}) { {#say "nosteal is empty"} {$tempnosteal = %concat( " ", "<", {@item.nosteal}, ">")}
#i#if@item.bsweapon = {}) { {#say "bsweapon is empty"} {$tempbsweapon = " Backstab"}
#i#if@item.doselevel = {}) { {#say "doselevel is empty"} {$tempdoselevel = %concat( " ", {@item.doselevel}, "Dose Lev")}
#i#if@item.dosespells = {}) { {#say "dosespells is empty"} {$tempdosespells = %concat( " ", {@item.dosespells}, "Dose SP")}
#i#if@item.Damtype = {}) { {#say "Damtype is empty"} {$tempdamtype = %concat( " ", {@item.damtype}, " Dam")}
#i#if@item.chargemax = {}) { {#say "chargemax is empty"} {$tempmana = %concat( " ", {@item.mana}, "Mana")}
#i#if@item.chargemax = {}) { {#say "chargemax is empty"} {$tempchargemax = %concat( " ", {@item.chargemax}, "Charges")}
#i#if@item.chargelevel = {}) { {#say "chargelevel is empty"} {$tempchargelevel = %concat( " ", {@item.chargelevel}, "ChargeLev")}
#i#if@item.chargespell = {}) { {#say "chargespell is empty"} {$tempchargespell = %concat( " ", {@item.chargespell}, " Spell")}
#i#if@item.minammodam = {}) { {#say "minammodam is empty"} {$tempminammodam = %concat( " ", "(", {@item.minammodam}, "-")}
#i#if@item.maxammodam = {}) { {#say "maxammodam is empty"} {$tempmaxammodam = %concat( {@item.maxammodam}, ")Dam")}
#i#if@item.visibility = {}) { {#say "visibility is empty"} {$tempvisibility = %concat( " ", {@item.visibility})}
#i#if@item.dropable = {}) { {#say "mana is dropable"} {$tempdropable = %concat( " ", {@item.dropable})}
#i#if@item.combinedeffects = {}) { {#say "combinedeffects is empty"} {$tempcombinedeffects = %concat( " ", {@item.combinedeffects})}
#i#if@item.cpqty = {}) { {#say "cpqty is empty"} {$tempcpqty = %concat( " ", {@item.cpqty}, "Vol")}
#i#if@item.norent = {}) { {#say "norent is empty"} {$tempnorent = %concat( " ", "<", {@item.norent}, ">")}
#i#if@item.removal = {}) { {#say "removal is empty"} {$tempremoval = %concat( " ", "<", {@item.removal}, ">")}
#i#if@item.mana = {}) { {#say "mana is empty"} {$tempmana = %concat( " ", {@item.mana}, "Mana")}
#i#if@item.ammotype = {}) { {#say "ammotype is empty"} {$tempammotype = %concat( " ", "<", {@item.ammotype}, ">")}
#i#if@item.scrollqty = {}) { {#say "scrollqty is empty"} {$tempscrollqty = %concat( " ", {@item.scrollqty}, "Vol")}
#i#if@item.bpouchqty = {}) { {#say "bpouchqty is empty"} {$tempbpouchqty = %concat( " ", {@item.bpouchqty}, "Vol")}
#i#if@item.potioncaseqty = {}) { {#say "potioncaseqty is empty"} {$temppotioncaseqty = %concat( " ", {@item.potioncaseqty}, "Vol")}
#i#if@item.keyringqty = {}) { {#say "keyringqty is empty"} {$tempkeyringqty = %concat( " ", {@item.keyringqty}, "Vol")}
#i#if@item.shootdammin = {}) { {#say "shootdammin is empty"} {$tempshootdammin = %concat( " ", "(", {@item.shootdammin}, "-")}
#i#if@item.shootdammax = {}) { {#say "shootdammax is empty"} {$tempshootdammax = %concat( {@item.shootdammax}, ")")}
#i#if@item.shootdambonus = {}) { {#say "shootdambonus is empty"} {$tempshootdambonus = %concat( " ", {@item.shootdambonus}, "Dam")}
#i#if@item.maxshootload = {}) { {#say "maxshootload is empty"} {$tempmaxshootload = %concat( " ", {@item.maxshootload}, "MaxLoad")}
#i#if@item.notake = {}) { {#say "notake is empty"} {$tempnotake = " <NoTake>"}
    #say %concat( $tempminlevel, $tempaffect1, $tempweight, $tempwearloc, $temphit, $tempdam, $tempac, $tempdex, $tempint, $tempstr, $tempcon, $tempwis, $temphp, $tempmana)
With all of the highlighting gone and the indented space that was in front of some of the if statements was replaced with #i. Also, I ran the reformat on this before and it worked, but it kept some of the #if statements in one level even though I'd think they should have been moved to the left... Or maybe the reformatter is supposed to leave indentations like that where they were.
Reply with quote
Zugg
MASTER


Joined: 25 Sep 2000
Posts: 23379
Location: Colorado, USA

PostPosted: Mon Jun 04, 2007 5:11 pm   
 
I'll add this to the bug list to fix since I don't want the reformatter to ever screw up scripts like this.

But I think the problem is with your indented #SAY command at the end of the script. It shouldn't be indented. You also have an #IF statement near the top that is indented improperly. When you indent like this, you are creating "continuation lines" which changes the meaning of your script. The reformatter can't undo those kind of indentations because it has no way to tell if it's intentional or not.

Also, when I load your original script into an alias, it gives a syntax error at the end because you are defining the local variables within the various #IF statements. You need a #LOCAL statement at the beginning of the script, such as:
Code:
#LOCAL $tempminlevel, $tempaffect1, $tempweight, $tempwearloc, $temphit, $tempdam, $tempac, $tempdex, $tempint, $tempstr, $tempcon, $tempwis, $temphp, $tempmana

if you want the local variables to be available to the entire script (otherwise they are just local to each #IF statement).

Also, your %concat syntax is wierd. You should just have stuff like:
Code:
$temphit = %concat(" ",@item.hit,"hit")

no need for the extra {} characters. Also, when testing to see if a variable is empty, you can use "" instead of {}.

In general, you shouldn't use the Reformat option if there are syntax errors in your script. The Reformat option uses the syntax parser, and with syntax errors the parser can make mistakes.

In any case, even with these changes it still seems to get messed up by Reformat, so I've added it to the bug list and will try to determine what's causing the problem.
Reply with quote
Guinn
Wizard


Joined: 03 Mar 2001
Posts: 1127
Location: London

PostPosted: Mon Jun 04, 2007 8:31 pm   
 
To make things easier, a trimmed version of the script that causes the same error is
Code:
#if (1) {
  #say blah1
}

#if (1) {#say blah2} {
  #SAY blah3
}
_________________
CMUD Pro, Windows Vista x64
Core2 Q6600, 4GB RAM, GeForce 8800GT
Because you need it for text... ;)
Reply with quote
jed
Adept


Joined: 18 Dec 2005
Posts: 246

PostPosted: Mon Jun 04, 2007 11:37 pm   
 
Ok, thanks for the replies. it's helped...
I changed the indenting on the one #say command and the one #if command zugg mentions and it still reformats incorrectly
Sorry i guess i didnt post the entire script... I have the variables defined above the section of code i included the script now looks like this:
Code:
#say sstr is working
$tempdam = ""
$temphit = ""
$tempac = ""
$tempminlevel = ""
$tempwearloc = ""
$tempweight = ""
$tempdex = ""
$tempint = ""
$tempstr = ""
$tempcon = ""
$tempwis = ""
$temphp = ""
$tempmindam = ""
$tempmaxdam = ""
$tempavedam = ""
$tempmv = ""
$tempsavevsspell = ""
$tempmana = ""
$tempforged = ""
$tempbarsqtyforged = ""
$tempaffect1 = ""
$tempaffect2 = ""
$tempaffect3 = ""
$tempaffect4 = ""
$tempaffect5 = ""
$tempaffect6 = ""
$tempcpspellpower = ""
$tempcpspell = ""
$tempcpduration = ""
$tempscrolllevel = ""
$tempscrollspell = ""
$tempbankable = ""
$tempnosteal = ""
$tempbsweapon = ""
$tempdoselevel = ""
$tempdosespells = ""
#say how about now
$tempdamtype = ""
$tempchargemax = ""
$tempchargelevel = ""
$tempchargespell = ""
$tempminammodam = ""
$tempmaxammodam = ""
$tempvisibility = ""
$tempdropable = ""
$tempcombinedeffects = ""
$tempcpqty = ""
$tempnorent = ""
$tempremoval = ""
$tempammotype = ""
$tempscrollqty = ""
$tempbpouchqty = ""
$temppotioncaseqty = ""
$tempfoodpackqty = ""
$tempkeyringqty = ""
$tempshootdammin = ""
$tempshootdammax = ""
$tempshootdambonus = ""
$tempmaxshootload = ""
$tempnotake = ""
#say maybenow
;#var tempac3 ""
#say or now
#say itemsac @item.ac
#show tempac3 @tempac3
;#var tempac3 @item.ac
#say after tempac3
#call %vartype(@tempac3,7)
#say after calltempac3
;#var tempac2 {}
#say after vartempac2
#call %vartype(@tempac2,7)
#say after calltempac2
#var tempac2 @tempac3/10
#say after tempac2
#show tempac2 @tempac2
#say howsaboutnow
#if (@item.hit = {}) {#say "hit is empty"} {
  $temphit = %concat(" ", @item.hit,"Hit")
  }
#if (@item.dam = {}) {#say "dam is empty"} {
  $tempdam = %concat(" ", @item.dam,"Dam")
  }
#if (@item.ac = {}) {#say "AC is empty"} {
  $tempac = %concat(" ",@tempac2,"AC")
  }
#if (@item.minlevel = {}) {#say "minlevel is empty"} {
  $tempminlevel = %concat( " ","L",{@item.minlevel})
  }
#if (@item.wearloc = {}) {#say "wearloc is empty"} {
  $tempwearloc = %proper(%concat({@item.wearloc}))
  }
#if (@item.wearloc = "weapon") {#if (@item.weight = {}) {#say "weight is empty"} {
  $tempweight = %concat(" ","WT",{@item.weight})
  } {}
  }
#if (@item.dex = {}) {#say "dex is empty"} {
  $tempdex = %concat(" ",{@item.dex},"Dex")
  }
#if (@item.int = {}) {#say "int is empty"} {
  $tempintgos  = %concat(" ",{@item.int},"Int")
  }
#if (@item.str = {}) {#say "str is empty"} {
  $tempstr = %concat(" ",{@item.str},"Str")
  }
#if (@item.con = {}) {#say "con is empty"} {
  $tempcon = %concat(" ",{@item.con},"Con")
  }
#if (@item.wis = {}) {#say "wis is empty"} {
  $tempwis = %concat(" ",{@item.wis},"Wis")
  }
#if (@item.hp = {}) {#say "hp is empty"} {
  $temphp = %concat(" ",{@item.hp},"HP")
  }
#if (@item.mindam = {}) {#say "mindam is empty"} {
  $tempmindam = %concat(" ","(",{@item.mindam},"-")
  }
#if (@item.maxdam = {}) {#say "maxdam is empty"} {
  $tempmaxdam = %concat({@item.maxdam},")")
  }
#if (@item.avedam = {}) {#say "avedam is empty"} {
  $tempavedam = %concat({@item.avedam},"Avg")
  }
#if (@item.mv = {}) {#say "mv is empty"} {
  $tempmv = %concat(" ",{@item.mv},"MV")
  }
#if (@item.savevsspell = {}) {#say "SaveVsSpell is empty"} {
  $tempsavevsspell = %concat(" ",{@item.savevsspell},"S vs spell")
  }
#if (@item.mana = {}) {#say "mana is empty"} {
  $tempmana = %concat(" ",{@item.mana},"Mana")
  }
#if (@item.forged = {}) {#say "forged is empty"} {
  $tempforged = %concat(" ",{@item.forged},"Forged")
  }
#if (@item.barsqtyforged = {}) {#say "barsqtyforged is empty"} {
  $tempbarsqtyforged = %concat(" ",{@item.barsqtyforged},"Frg Bars")
  }
#if (@item.affect1 = {}) {#say "affect1 is empty"} {
  $tempaffect1 = %concat(" ","(",{@item.affect1},")")
  }
#if (@item.affect2 = {}) {#say "affect2 is empty"} {
  $tempaffect2 = %concat(" ","(",{@item.affect2},")")
  }
#if (@item.affect3 = {}) {#say "affect3 is empty"} {
  $tempaffect3 = %concat(" ","(",{@item.affect3},")")
  }
#if (@item.affect4 = {}) {#say "affect4 is empty"} {
  $tempaffect4 = %concat(" ","(",{@item.affect4},")")
  }
#if (@item.affect5 = {}) {#say "affect5 is empty"} {
  $tempaffect5 = %concat(" ","(",{@item.affect5},")")
  }
#if (@item.affect6 = {}) {#say "affect6 is empty"} {
  $tempaffect6 = %concat(" ","(",{@item.affect6},")")
  }
#if (@item.cpspellpower = {}) {#say "cpspellpower is empty"} {
  $tempcpspellpower = %concat(" ","(",{@item.cpspellpower},")")
  }
#if (@item.cpspell = {}) {#say "cpspell is empty"} {
  $tempcpspell = %concat(" ",{@item.cpspell},"Foci")
  }
#if (@item.scrolllevel = {}) {#say "scrolllevel is empty"} {
  $tempscrolllevel = %concat(" ",{@item.scrolllevel},"ScrLev")
  }
#if (@item.scrollspell = {}) {#say "scrollspell is empty"} {
  $tempscrollspell = %concat(" ",{@item.scrollspell}, "ScrSpell")
  }
#if (@item.bankable = {}) {#say "bankable is empty"} {
  $tempbankable = %concat(" ",%proper({@item.bankable}))
  }
#if (@item.nosteal = {}) {#say "nosteal is empty"} {
  $tempnosteal = %concat(" ",%proper({@item.nosteal}))
  }
#if (@item.bsweapon = {}) {#say "bsweapon is empty"} {
  $tempbsweapon = " BKSTB"
  }
#if (@item.doselevel = {}) {#say "doselevel is empty"} {
  $tempdoselevel = %concat(" ",{@item.doselevel},"Dose Lev")
  }
#if (@item.dosespells = {}) {#say "dosespells is empty"} {
  $tempdosespells = %concat(" ",{@item.dosespells},"Dose SP")
  }
#if (@item.Damtype = {}) {#say "Damtype is empty"} {
  $tempdamtype = %concat(" ",%proper({@item.damtype})," Dam")
  }
#if (@item.chargemax = {}) {#say "chargemax is empty"} {
  $tempmana = %concat(" ",{@item.mana},"Mana")
  }
#if (@item.chargemax = {}) {#say "chargemax is empty"} {
  $tempchargemax = %concat(" ",{@item.chargemax},"Charges")
  }
#if (@item.chargelevel = {}) {#say "chargelevel is empty"} {
  $tempchargelevel = %concat(" ",{@item.chargelevel},"ChargeLev")
  }
#if (@item.chargespell = {}) {#say "chargespell is empty"} {
  $tempchargespell = %concat(" ",{@item.chargespell}," Spell")
  }
#if (@item.minammodam = {}) {#say "minammodam is empty"} {
  $tempminammodam = %concat(" ","(",{@item.minammodam},"-")
  }
#if (@item.maxammodam = {}) {#say "maxammodam is empty"} {
  $tempmaxammodam = %concat({@item.maxammodam},")Dam")
  }
#if (@item.visibility = {}) {#say "visibility is empty"} {
  $tempvisibility = %concat(" ",{@item.visibility})
  }
#if (@item.dropable = {}) {#say "mana is dropable"} {
  $tempdropable = %concat(" ",%proper(@item.dropable))
  }
#if (@item.combinedeffects = {}) {#say "combinedeffects is empty"} {
  $tempcombinedeffects = %concat(" ",{@item.combinedeffects})
  }
#if (@item.cpqty = {}) {#say "cpqty is empty"} {
  $tempcpqty = %concat(" ",{@item.cpqty},"Vol")
  }
#if (@item.norent = {}) {#say "norent is empty"} {
  $tempnorent = %concat(" ",%proper({@item.norent}))
  }
#if (@item.removal = {}) {#say "removal is empty"} {
  $tempremoval = %concat(" ",%proper({@item.removal}))
  }
#if (@item.mana = {}) {#say "mana is empty"} {
  $tempmana = %concat(" ",{@item.mana},"Mana")
  }
#if (@item.ammotype = {}) {#say "ammotype is empty"} {
  $tempammotype = %concat(" ",%proper({@item.ammotype})," Ammo")
  }
#if (@item.scrollqty = {}) {#say "scrollqty is empty"} {
  $tempscrollqty = %concat(" ",{@item.scrollqty},"Vol")
  }
#if (@item.bpouchqty = {}) {#say "bpouchqty is empty"} {
  $tempbpouchqty = %concat(" ",{@item.bpouchqty},"Vol")
  }
#if (@item.potioncaseqty = {}) {#say "potioncaseqty is empty"} {
  $temppotioncaseqty = %concat(" ",{@item.potioncaseqty},"Vol")
  }
#if (@item.keyringqty = {}) {#say "keyringqty is empty"} {
  $tempkeyringqty = %concat(" ",{@item.keyringqty},"Vol")
  }
#if (@item.shootdammin = {}) {#say "shootdammin is empty"} {
  $tempshootdammin = %concat(" ","(",{@item.shootdammin},"-")
  }
#if (@item.shootdammax = {}) {#say "shootdammax is empty"} {
  $tempshootdammax = %concat({@item.shootdammax},")")
  }
#if (@item.shootdambonus = {}) {#say "shootdambonus is empty"} {
  $tempshootdambonus = %concat(" ",{@item.shootdambonus},"Dam")
  }
#if (@item.maxshootload = {}) {#say "maxshootload is empty"} {
  $tempmaxshootload = %concat(" ",{@item.maxshootload},"MaxLoad")
  }
#if (@item.notake = {}) {#say "notake is empty"} {
  $tempnotake = " NoTake"}
#say %concat($tempwearloc,$tempminlevel,$tempweight,$tempbsweapon,$tempmindam,$tempmaxdam,$tempavedam,$tempstr,$tempint,$tempwis,$temphit,$tempdam,$tempac,$temphp,$tempmana,$tempmv,$tempsavevsspell,$tempforged,$tempbarsqtyforged,$tempaffect1,$tempaffect2,$tempaffect3,$tempaffect4,$tempaffect5,$tempaffect6,$tempcpspellpower,$tempcpspell,$tempcpduration,$tempscrolllevel,$tempscrollspell,$tempbankable,$tempnosteal,$tempdoselevel,$tempdosespells,$tempdamtype,$tempchargespell,$tempchargelevel,$tempchargemax,$tempminammodam,$tempmaxammodam,$tempvisibility,$tempdropable,$tempcombinedeffects,$tempcpqty,$tempnorent,$tempremoval,$tempammotype,$tempscrollqty,$tempbpouchqty,$temppotioncaseqty,$tempfoodpackqty,$tempkeyringqty,$tempshootdammin,$tempshootdammax,$tempshootdambonus,$tempmaxshootload,$tempnotake)
I had originally written the %concat functions without the braces around the @item.whatever, but when I did that, it injected the value for the entire @item in there rather than the value just for @item.whatever.... I think i've figured that out, in that didnt have a space before the @item.whatever, i just had it tight with the comma... I guess i need to change that all through. Zugg mentiones testing against "" instead of {}. Is there a reason why I should use one or the other? will using {} slow things down or is it incorrect or something?bad habit??
As far as the indents on the reformat i didnt know i needed to have each command all the way to the left prior to running the reformat. Thanks for pointing this out!!!
Very Happy
Reply with quote
MattLofton
GURU


Joined: 23 Dec 2000
Posts: 4834
Location: USA

PostPosted: Mon Jun 04, 2007 11:43 pm   
 
The {} isn't really wrong, per se, but it might cause confusion as they are used for expansion now whereas "" prevents it completely. Thus, if you want to get at the value of something you use {%1} but if you need the name of something or need to prevent that name from expanding you'd use "%1".

With an empty value, it doesn't quite matter so it just boils down to making the parser happy.
_________________
EDIT: I didn't like my old signature
Reply with quote
Display posts from previous:   
Post new topic   Reply to topic     Home » Forums » CMUD Beta Forum All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum

© 2009 Zugg Software. Hosted by Wolfpaw.net