Error executing custom function

Discuss macro implementations, ask for macro help (to share your creations, see User Creations, probably either Campaign Frameworks or Drop-in Resources).

Moderators: dorpond, trevor, Azhrei, giliath, jay, Mr.Ice

Post Reply
xanos_25
Kobold
Posts: 5
Joined: Wed Jan 11, 2017 6:22 pm

Error executing custom function

Post by xanos_25 »

The function be works fine if I directly click on it

Code: Select all

[Bonus="Training"]<br>
[Value="3"]<br>
[work="Base=13; Arcane=3,-4; Divine=2,4; Training=2; Racial=2; infernal=-1,-2"]<br>

[h:result = getstrprop(work,bonus,"None")]
[h,if(result=="None"):result=value;result=listappend(result,value)]

[h:work=setstrprop(work,bonus,result)]

[r:work]
I put the following in onCampaignLoad

Code: Select all

[defineFunction("Bonus.Add", "AddBonus@Lib:Parse")]
Then i make a macro with the following line (only)

Code: Select all

[bonus.add()]
And get the following error.
java.lang.NullPointerException error executing expression bonus.add().
I've defined a couple of other functions which are working flawlessly And The function exists (would give a function undefined error otherwise)
It's better to be a Morloc then an Eloi

User avatar
aliasmask
RPTools Team
Posts: 9024
Joined: Tue Nov 10, 2009 6:11 pm
Location: Bay Area

Re: Error executing custom function

Post by aliasmask »

Probably the apply to selected token isn't checked and/or the macro needs to uncheck Allow Players to edit.

xanos_25
Kobold
Posts: 5
Joined: Wed Jan 11, 2017 6:22 pm

Re: Error executing custom function

Post by xanos_25 »

Check, not writable by players and have tried with apply to selected tokens both on and off with no difference.

My understanding of Apply to Selected Tokens is that it only matters if the macro is actually affecting a token. Am I incorrect on that?
It's better to be a Morloc then an Eloi

User avatar
aliasmask
RPTools Team
Posts: 9024
Joined: Tue Nov 10, 2009 6:11 pm
Location: Bay Area

Re: Error executing custom function

Post by aliasmask »

You're right, it's just something I just always suggest checking first. The UDFs may actually be case sensitive, so I would try using the proper case in your function call. It's a good idea to always use the proper case for everything even if the parser may ignore it.

xanos_25
Kobold
Posts: 5
Joined: Wed Jan 11, 2017 6:22 pm

Re: Error executing custom function

Post by xanos_25 »

That actually worked :D ... I should have thought of that. I actually went to school for programming but haven't done much for 15+ years. Am a little rusty.
It's better to be a Morloc then an Eloi

Post Reply

Return to “Macros”