View Single Post
Lord Magus
Senior Member
 
Join Date: Jan 2011
Location: Quebec, QC, Canada
Posts: 468

Old August 12th, 2023, 05:04 PM
I am running into trouble with a particular item I am coding

It is a special armor that is easily enchanted with specific armor item powers, reducing the cost of such powers by half.

I have tried the following 2 scripts at First - 2550, but I get the error message:
Syntax error in 'eval' script for Thing 'mAMSAWvScl' (Eval Script '#1') on line 1
-> Script reference is invalid under the circumstances

Code:
  perform findchild[BaseItemPw,thingid.ipAMSAArFo?].setfocus
  focus.field[iPriceCash].value *= 0.5
Code:
  perform container.gizmo.setfocus
  if (focus.tagis[thingid.ipAMSAArFo?] <> 0) then
    focus.field[iPriceCash].value *= 0.5
  endif
I then tried this
Code:
  foreach pick in gizmo from BaseItemPw where "thingid.ipAMSAArFo?"
    eachpick.field[iPriceCash].value *= 0.5
  nexteach
which at least compiled but did not reduce the price and gave me this message
Attempt to access non-existent containing entity from script
- - -
Can't foreach over invalid container (this is probably related to a previous error)
- - -
Can't foreach over invalid container (this is probably related to a previous error)

Finally, it dawned on me that the armor type and the item powers are both gizmos on a magic armor pick, so I tried
Code:
  perform container.parent.setfocus
  perform focus.findchild[BaseItemPw,thingid.ipAMSAArFo?].setfocus
  focus.field[iPriceCash].value *= 0.5
and got the same error as the first 2 tries.

Is it possible to steer me in the right direction or at least to point me to an item that does a similar thing? I feel like I'm getting lost in transitions here. Thanks!
Lord Magus is offline   #1 Reply With Quote