• Please note: In an effort to ensure that all of our users feel welcome on our forums, we’ve updated our forum rules. You can review the updated rules here: http://forums.wolflair.com/showthread.php?t=5528.

    If a fellow Community member is not following the forum rules, please report the post by clicking the Report button (the red yield sign on the left) located on every post. This will notify the moderators directly. If you have any questions about these new rules, please contact support@wolflair.com.

    - The Lone Wolf Development Team

Specials Output on weapons

RavenX

Well-known member
Mathias,

I'm trying to figure out what I need to put in this foreach loop to get a list of livenames strung together for output that displays weapon qualities.

I think this is the foreach loop I need:

Code:
foreach bootstrap in entity where "component.WeapQual"
    special = splice(special,eachthing.field[livename].text,", ")
    nexteach

I can't figure out why I keep getting this error message:
"Use of 'foreach' directly upon an entity requires a pick script context
Location: Procedure 'InfoWeapSp' near line 10

I thought the eachthing was the pick context?
 
I believe the issue is what type of procedure InfoWeapSp is. For example, here are a couple different procedure entries:

<procedure id="AddListMod" context="pick"><![CDATA[

<procedure id="GenCalcTxt" scripttype="eval"><![CDATA[

<procedure id="InfoRace" context="info"><![CDATA[

I think certain scripttype attributes have certain contexts assumed for them.
 
Code:
  <!-- Procedure InfoWeapSp
        Generate special abilities specific to all weapons. This is separate from
        the "InfoWeapon" procedure so that it can always be performed last. The
        text is placed into the "iteminfo" variable for subsequent use by our caller.

        Outbound parameter: iteminfo
  -->
  <procedure id="InfoWeapSp" context="info"><![CDATA[
    ~declare variables that are used to communicate with our caller
    var iteminfo as string

    ~report any special details about the weapon (omitting if there are none)
    var special as string
    ~special = tagnames[Weapon.?,", "]
    ~special = splice(special,field[wpSpecial].text,", ") 
      ~if (tagis[WeapQual.?] <> 0) then
       foreach bootstrap in entity where "component.WeapQual"
         special = splice(special,eachthing.field[livename].text,", ")
         nexteach
        ~endif
    ~foreach pick in hero from WeaponBase where "WeapQual.?"
      ~special = splice(special,field[livename].text,", ")
      ~nexteach
    if (empty(special) = 0) then
      iteminfo &= "{b}Special:{/b} " & special & "{br}"
      endif
        ~If we have a renown requirement, show it
    if (tagis[Renown.?] <> 0) then
      iteminfo &= "{b}Renown Required:{/b} " & tagnames[Renown.?] & "{br}"
      endif
    ]]></procedure>

Do I need to separate out my script for specials list then?
 
Entity and Gizmo are like Thing and Pick - they're the same thing before and after you've added them to the character.

So:

Code:
if (ispick <> 0) then
  if (isgizmo <> 0) then
    foreach pick in gizmo from WeapQual
 
Ah, sorry for pointing you in the wrong direction RavenX.

Aaron,

It's not a problem, I learned what I could from the Authoring Kit Wiki but it wasn't working no matter what I tried last night. I'm happy it is finally working, it is one less thing on the to-do list now. No worries, man, I'm not holding a grudge over it. I just want to get this cranked out.
 
Back
Top