Roll20 uses cookies to improve your experience on our site. Cookies enable you to enjoy certain features, social sharing functionality, and tailor message and display ads to your interests on our site and others. They also help us understand how our site is being used. By continuing to use our site, you consent to our use of cookies. Update your cookie preferences .
×
Create a free account

TypeError: u is undefined

I have been building macros for my RQ game.  I have a sequence of characteristic macros that I would like to nest to save screen space.  An example of a characteristic roll is (for intelligence) &{template:default} {{name= @{selected|name} tests Intelligence}} [[ [[@{selected|INT}*?{multiplier|5}]] [[@{selected|INT}*?{multiplier}/5]] [[floor(@{selected|INT}*?{multiplier}/20)]] ]] {{Intelligence= test value is $[[0]] }} {{Roll=[[1d100]] }} {{Special= $[[1]] or less}} {{Critical= $[[2]] or less}} It took me some time to work out how to make this work by copying stuff from elsewhere plus a bit of trial and error. I then tried to nest macros. ?{Which characteristic?|INT,#IntelligenceM |STR,#StrengthM  } I stuck to two characteristics INT and STR and made additional macros for those, after a substantial further amount of trial and error, and I think I have made the necessary substitutions in the code.  I have seen lots of error messages where the mistakes were obviously mine and I have gone in, again and again tweaking codes. I thought I had it and then I got this message: TypeError: u is undefined This is not covered in your help forums and potentially takes me even further out of my depth than I already was. Any suggestions welcome but please do remember that I do not speak code! :-) Stephen
1629559341
Kraynic
Pro
Sheet Author
Since you have the initial macro working, I would say simply don't use a query for which attribute you want to test.&nbsp; Use a chat menu instead, since that can totally avoid all that html replacement business. <a href="https://wiki.roll20.net/Chat_Menu" rel="nofollow">https://wiki.roll20.net/Chat_Menu</a>
My kind of thinking!&nbsp; If you cannot see a way through, go around.&nbsp; :-)&nbsp; I will have to do more reading, I have never seen, never mind used a chat menu... Thanks for the pointer.
1629578851
Kraynic
Pro
Sheet Author
When I first started using Roll20, I used queries everywhere.&nbsp; Then I decided I didn't like answering queries every time I did something.&nbsp; Then I discovered chat menus and barely remember how to do queries anymore...
1629616252

Edited 1629616302
Well, I succeeded.&nbsp; Will be playing with that for some time. If anyone knows why the original error occurs, that would be interesting but the chat menu is a solution that achieves the desired end result. Thanks Kraynic.
1629744136

Edited 1629744158
I have encountered a problem with the chat menus.&nbsp; I have a macro which works as a standalone but not when invoked via a button.&nbsp; It seems to work but then nothing appears in chat.&nbsp; I am presuming there is something to do with selected characters but cannot work it out. The macro in question is as below.&nbsp; Happy for any input... &amp;{template:default} {{Action=@{selected|token_name} engages @{target|token_name} }} {{Roll=[[1d100]]}} {{Success=[[floor(50+((?{@{selected|token_name}|STR,(@{selected|curSTR})|CON,(@{selected|curCON})|SIZ,(@{selected|curSIZ})|INT,(@{selected|curINT})|POW,(@{selected|curPOW})|DEX,(@{selected|curDEX})|CHR,(@{selected|curCHR})})-(?{@{target|token_name}|STR,(@{target|curSTR})|CON,(@{target|curCON})|SIZ,(@{target|curSIZ})|INT,(@{target|curINT})|POW,(@{target|curPOW})|DEX,(@{target|curDEX})|CHR,(@{target|curCHR})}))*5)]] }} Essentially it allows one character to test a characteristic against someone else's... Stephen