Jump to content

"Cannot Convert to Integer"


JediMindTrix

Recommended Posts

I have two small blocks of weidu that cause inexplicable (to me) "cannot convert x or %x% to integer".

LPF ADD_CRE_EFFECT //protection from spell
INT_VAR
  opcode = 206
  timing = 1
  probability1 = 100
  resource = ABAZDG02
END
LPF ADD_CRE_EFFECT INT_VAR //Play 3D Effect
   opcode = 215
   target = 0
   parameter1 = 0
   parameter2 = 1
   timing = 9
   sourceslot = AMYAG_B
  END

I have plenty of nearly identical, completely functional weidu command blocks but these two consistently return the error no matter what I've tried. Removing them eliminates installation errors.

 

Any ideas? Am I missing something obvious?

 

EDIT: I am, STR_VAR - for the first block, anyway. Still clueless on the second.

Link to comment

Try:

LPF ADD_CRE_EFFECT //protection from spell
  INT_VAR
    opcode = 206
    timing = 1
    probability1 = 100
STR_VAR
    resource = ABAZDG02
END
The how the AMYAG_B needs to be set is the string variable in the second, aka:

 

LPF ADD_CRE_EFFECT  //Play 3D Effect
  INT_VAR
    opcode = 215
    target = 0
    parameter1 = 0
    parameter2 = 1
    timing = 9
  STR_VAR
   resource = AMYAG_B
  END
The sourceslot variable you try to use, is actually used to set the effects source, with can be 0 = none, 1 = a spell or 2 = an item. If you don't set the variable like in my above example, it defaults to the 0 which is none, so it's not attached to an item or a spell.
Link to comment

Thanks everyone!

 

To explain Jarno's correctins, INT_VAR precedes values that take integers; STR_VAR precedes values that takes strings. (I think.)

To correct a bit more, I think after STR_VAR, ABAZDG02 and AMYAG_B should be in quotes or tildes ("..." or ~...~)

 

There are a lot of instances in my .tpa's where resources are named with tilde's or quotations, and produce no errors. I suppose that doesn't mean nothing is breaking but I assumed WeidU would've said something?

Link to comment

There are a lot of instances in my .tpa's where resources are named with tilde's or quotations, and produce no errors. I suppose that doesn't mean nothing is breaking but I assumed WeidU would've said something?

I have seen both, it doesn't hurt to add them, but they shouldn't be strictly necessary. You do need the tildes etc if you have a negative value to insert to the variable.
Link to comment

They aren't needed for strings except when the strings contain special characters that would confuse WeiDU's parser.

 

However, I quote all my string values (usually with tildes), for consistency and because it's a habit I learned from other programming languages. It makes it easier to tell strings apart from variables when using code highlighting, too.

Link to comment

for consistency ... It makes it easier to tell strings apart from variables when using code highlighting, too.

Hmm, I wonder how consistent you are with that. AKA can we see you code the above as:

LPF ADD_CRE_EFFECT //protection from spell
  INT_VAR
    ~opcode~ = 206
    ~timing~ = 1
    ~probability1~ = 100
STR_VAR
    ~resource~ = ~ABAZDG02~
END

:p Ha...

Link to comment

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...