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

[Help] Can someone help me figure out where I broke my code?

Hi all, I'm extremely new to coding (as in, I went through the codecademy HTML/CSS basics courses 2 days ago) and have been trying to cannibalize the 'Basic Fantasy RPG' character sheet that Solomoriah posted last year. I have edited a few portions to overall suit our homebrew system better; however, I am having major issues with the following things: 1. I cannot figure out how to set up a way to add weapons into the sheet as needed by the player (filling out weapon class and any extra bonuses as needed) and checking a specific weapon among many to be the "used" weapon which is then factored in on a combat macro. After getting frustrated by it for an hour, I gave up in hope of someone more knowledgeable helping me. 2. I am also dealing with trying to figure out why not all of my character sheet is displaying in-game. The preview of the sheet, as I write it, shows everything, if a bit wonky; the actual game cuts off just below a section list of inputs for character skills. I have quadruple-checked the code and I do not see what I could have done to make the rest below that section disappear.  3. Specifically in the mentioned skill sections, I literally copied and pasted the same code for each type of physical attribute (couldn't figure out how to make a generic and repeatable skill that a player could select which physical attribute would be used as a modifier, similar to the frustration of issue #1), yet the header of each section after the first did not display correctly. One line should have been the type of attribute (i.e. 'Strength Skills,' 'Dexterity Skills,' etc.) and the next line should have had 'Skill,' 'Skill Level', 'D20,' and 'CP,' accordingly, but only the first section (Strength Skills) would display properly. In the code I have now, I just got rid of those lines for the sections following Strength. 4. I have been typing my code in Roll20, so I'm not even sure how to save the file as an .html file. I've just been copying/pasting the code into a .txt file but it won't let me upload that.  So can anyone help me out here? I'd really love to try learning more about how to code in my free time but I'd also be immensely grateful if someone was willing to simply take what I have and fix it per above so I have something working in the short-term. Sorry for the noob thread and thank you in advance.
The preview pane does not work well enough. Open a second tab, with the game in question open and look at the sheet there after every change. You will obviously need to refresh the page to see the new changes. This is the only way you will 'see' the sheet the way it will really look. If your sheet is cutting off then you either: ended it too early, made a syntax error that cuts it out or forgot to end it in the proper way. Repeating sections: more pain that they are worth, in my opinion. I went with a set number of melee weapons, ranged weapon and skill slots, but they can be done. Without knowing your format, or the sheet you took them from, I myself can't tell you what is wrong with yours. I can show you an example of mine from one of my very basic sheets: <fieldset class="repeating_Meleeweapons"> <div class="sheet-row"> <div class="sheet-item sheet-medium"><input type="text" name="attr_MeleeWeaponName"/></div> <div class="sheet-item sheet-tiny"><input type="number" name="attr_MeleeAttackBonus" value="0"/></div> <div class="sheet-item sheet-tiny"><input type="text" name="attr_MeleeWeaponDmg"/></div> <div class="sheet-item sheet-medium"><input type="text" name="attr_MeleeWeaponSpecial"/></div> <div class="sheet-item sheet-tiny"> <button class="sheet-square" type="roll" value="/em attacks with a @{MeleeWeaponName}, hitting AC:[[@{THAC0} - (1d20 + @{STRmod} [STR] + @{MeleeAttackBonus} [WeapMod])]] for [[@{MeleeWeaponDmg}+@{STRmod}+@{MeleeAttackBonus}]] damage" name="BasicMeleeAttackRoll"/> </div> </div> </fieldset> As far as your issue with "checking a specific weapon among many to be the "used" weapon which is then factored in on a combat macro" I put the roll button at the end of the weapon. Repeating fields are, again in my opinion, to much bother to refer to individually from in a macro. I took the macro to them. For specific use weapons or favorites, I just wrote custom macros for characters/monsters that are used as token actions. Easier to modify to taste. As for fixed fields, you can have a roll button at the end and after using it, go to the chat window, press the 'up' directional key on your keyboard, copy the template/code the button spit out into chat, paste that in a macro on your abilities tab. "I have been typing my code in Roll20, so I'm not even sure how to save the file as an .html file. I've just been copying/pasting the code into a .txt file but it won't let me upload that. " What is it that you are trying to upload? Normally, anything you want to put into your html/css section on Roll20, you just open your .txt file, copy what what you need, go to the html/css pane of your Roll20 page settings sheet section and paste. Your skills all have to have thier own attribute names. not sure if this was the issue as you only stated "yet the header of each section after the first did not display correctly" I'd be willing to jump in your game and take a look. I am an expert by no means, but help is help. Someone else with html/css savoy will be along any minute now, but these are just one copy/paste hack to another.
1439434215
Finderski
Plus
Sheet Author
Compendium Curator
Happy to help you fix your code.  An html file is nothing more than a text file with a .html extension rather than a .txt, so you could save the file and then just rename it. I'm assuming you were wanting to do that so others could see the code itself? Because to help fix the code we'd need to see it.  I'd recommend posting it in this forum.  To do so, just click on the paragraph icon (upper left corner of the reply box) and select "code", then just copy/paste your html into the code block in your reply post.  I'd recommend posting your HTML and your CSS so we can see everything.  If the code is very large, then upload it somewhere (like github) and link to it.
Thanks, both of you. I have no idea how to properly add files to Github, but here are the links to my  HTML and  CSS . I can also just email the txt files to either of you, if you're interested. OldSchoolChris, what I wanted to do regarding both the weapons and the skills was set up a way to have only as many slots as needed per character rather than having excessive ones just for possibly needing them here and there. I have the skills sections set up for 7 skill slots per physical attribute (Strength, Dexterity, etc.), but would rather figure out a way to make repeating sections where the player can define which physical attribute is used as a modifier for each skill. That way, the character sheet can be set up exactly how the player wants and there aren't any empty slots just filling up space. The problem I ran into with this (among others brought on by my inept coding skills) was figuring out a way to 'select' what attribute was used as a modifier and what weapon would be used. Is there at least a way to set up through code a way of picking which item is 'in use' for a given macro? As in, using checkboxes or radio buttons to tell the macro to use the bonuses and mods from that specific weapon? As for uploading, I just meant I wanted to upload the txt files on here so you all could see and download them instead of having me try to explain what problems I'm having. The last bit you quoted was referring to the column headers ("Skill, Skill Level, D20, CP"), not the names of each specific skill. I think I figured out how to identify each of those in the code properly, but again, I would appreciate more and better experienced eyes looking over everything to see if I've made any other errors that I just haven't caught onto yet.
Here's the link (sorta?) to both the HTML and CSS on Github:  Github Link Hopefully it worked.
Here are the in-game pictures of what's going wrong with my spacing (note: I added a couple things since uploading the above code, so you won't see the Disadvantages section in the code there).