#Function = parameter error

1 messages · Page 1 of 1 (latest)

carmine mango
#

Running into an issue where I'm trying to use my tooltip code and its spitting out "function '=' requires exactly 2 paramters, 1 were provided" but not telling me the line or where. Im beating my head against this and I know its gonna be obvious and/or stupid

[h: SaveTooltip = hoverTooltip2(130, "blue", SaveEquat, "8" 8, "PB", Proficiency, "Int Mod", intmod)]
[h: SaveEquat = strformat("8 + PB +  Mod")]
[h: SaveRoll = 8 + Proficiency + IntMod]

[IF(SpellcastingStat != ''),CODE:{
<div style="background-color: #default; color:#black; padding-top:2px; padding-bottom:5px; padding-left:8px; padding-right:8px;">
    <b>[r: Name]</b>
    <div style="background-color: #FFFFFF; color: #000000; paddiong:2px;">
            <span style="font-size:1.5em;">Spell Save DC = <b><span style="font-size:1.5em;" title="[r:SaveTooltip]">[r: SaveRoll]</b></span></span>
    </div>
</div>
};{
    [r: "You do not have a spellcasting stat listed!"]
}]```

Tooltip code: ```[h: width = arg(0)]
[h: bgcolor = arg(1)]
[h: caption = arg(2)]

[h: entryText = ""]
[h: maxArg = floor((argCount()-3)/2)]
[h, for(arg_i, 0, maxArg):
    entryText = entryText + strformat("<tr><th>%s</th><td>%s</td></tr>", arg(2*arg_i+3), arg(2*arg_i+4))
]

[h: macro.return = strformat("<html><table width=%{width} bgcolor=black cellspacing=1><table width=%{width} bgcolor=white color=black cellspacing=2><caption nowrap bgcolor=%{bgcolor} color=black>%{caption}</caption>%{entryText}</table></table></html>")]```
carmine mango
#

it appears to be something in the first 4 lines but im clearly missing something or being dumb

thorn void
#

Could it be SaveEquat? You're using it in the function call, but not assigning a value until after the function returns? That means inside the function, the statement caption = arg(2) doesn't make any sense. (Strange that you don't get any context for the error message, though. Sounds like a bug.)

carmine mango
#

I tried moving itr, didnt seem to work

#
[h: SaveEquat = strformat("8 + PB +  Mod")]
[h: SaveRoll = 8 + Proficiency + IntMod]

[h: SaveTooltip = hoverTooltip2(130, "#4A75A2", SaveEquat, "8" 8, "PB", Proficiency, "Int Mod", intmod)]```
#

thats my new order of listing

#

as an example:

#
[h: DamageType = "Shield"]

[h: TempTooltip = hoverTooltip2(130, "#9E88B2", "Artificer Level", "Artificer Level", Level)]

[h: TempRoll = Level]

<div style="background-color: #9E88B2; color: #000000; padding-top:2px; padding-bottom:5px; padding-left:8px; padding-right:8px;">
    <b>[r: Name] ([r: DamageType])</b>
    <div style="background-color: #FFFFFF; color: #000000; padding:2px;">
        <span style="font-size:1.5em;">Temp Health: <b><span style="font-size:1.5em;" title="[r: TempTooltip]">[r: TempRoll]</span></b></span><br>
        
    </div>
</div>

[h: getTemp = getProperty("tempHP")]
[h: newTemp = Level]
[IF(!isNumber(getTemp)),CODE:{
   [h: getTemp =0]
};{}]
[IF(newTemp > getTemp),CODE:{
  [h: setProperty("tempHP", newTemp)]
};{}]``` this is defensive field's macro
#

which comes out like this

thorn void
#

Ah, so it works with that input, but not with the other? That's a good start...

carmine mango
#

Its a fair bit bigger cause it accounts for advance vs disadvantage rolls n organizing them n stuff

thorn void
#

Ah, you're missing a comma. Back in the first code, you have "8" 8 as the fourth parameter.

carmine mango
#

eh

#

SON OF A B

#

99 LINES OF CODE ON THE WALL

#

AAAAAAAAAAAAAAAAAH

thorn void
#

No idea why the error message says "function '='" except that parameters are assigned values when the function is called and it's probably the same routine as the one that does the equals sign...

carmine mango
#

yeah i dunno either

#

makes it a pain to find issues sometimes

#

cause ive had it before

#

thanks for helping me realize im just a dumbass