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

Set Checkbox Programatically

September 23 (1 year ago)
Joab
Pro

I have written a character generator API for DarkShip. The skills are indicated by checkboxes on the character sheet. How can I check the checkbox from the API? Here's an example:

        switch (DSBUILD.Skill1) {
            // Teamster
        case 'Scavenging':
            createObj('attribute', {
                name: 'character_Scavanging',
                current: on,
                _characterid: character.id
            });
        case 'Melee Combat':
            createObj('attribute', {
                name: 'character_Melee',
                current: on,
                _characterid: character.id
            });
...

September 23 (1 year ago)
Scott C.
Forum Champion
Sheet Author
API Scripter
Compendium Curator

You set the value to whatever the checked value of the checkbox is.

September 23 (1 year ago)
Joab
Pro

The code above is not working. I've tried on and 'on'. Suggestions?

September 23 (1 year ago)
Scott C.
Forum Champion
Sheet Author
API Scripter
Compendium Curator

The checked value is set by the sheet. Click the checkmark on the sheet and then call that attribute in chat and see what is returned.

September 23 (1 year ago)
Joab
Pro

I did that, and the field says "on" (no quotes).

September 23 (1 year ago)
Scott C.
Forum Champion
Sheet Author
API Scripter
Compendium Curator

I just noticed that you used

current: on,

in your createObj, that definitely needs to be 'on', as otherwise it's just a variable call and will probably crash from using a variable that hasn't been defined.

Other things to check though:

  • typos? I notice you have character_scavanging. Should that be character_scavenging? Also, are all attribute really prepended with character_?
  • Do these attributes already exist on the sheet? Creating another version of them instead of just setting the existing one will cause unexpected behavior.
  • What is the piece that isn't working? Is the checkbox on the sheet not checking? or is something that is supposed to be displayed/calculated when it is checked not happening?
  • Can you share a link to the sheet code?


September 23 (1 year ago)
Joab
Pro

Here is the Mod

/**
 * Generates DarkShip Characters
 *
 * Syntax: !DSBUILD option
 *
 */

var DSBUILD = DSBUILD || {
    version: "0.0.4",
    output: [],

    listen: function () {

        on('chat:message', function (msg) {
            // Exit if not an api command
            if (msg.type != "api") {
                return;
            }
            switch (msg.content) {
            case '!NPCClass':
                DSBUILD.NPCClass(msg);
                break;
            case '!NPCSkills':
                DSBUILD.NPCSkills(msg);
                break;
            case '!NPCLoadout':
                DSBUILD.NPCLoadout(msg);
                break;
            case '!CharView':
                DSBUILD.printSheet(msg);
                break;
            case '!SaveChar':
                DSBUILD.save(msg);
                break;
            default:
                return;
            }
        });
    },

    showHelp: function () {
        sendChat("API", "/w gm <table style='background: #DCD9D5; border-radius: 20px; font-size: 10px;'>" +
            "<thead><tr><th>Help</th></tr></thead>" +
            "<tbody>" +
            "<tr><td><strong>!DSBUILD</strong><br><strong>!fodder help</strong><br>Show this help screen.</td></tr>" +
            "<tr><td><strong>!DSBUILD core</strong><br>Runs the script.</td></tr>" +
            "<tr><td> </td></tr>" +
            "</td></tr></tbody></table>");
    },

    NPCClass: function (msg) {
        DSBUILD.id = msg.playerid;
        DSBUILD.name = msg.who + " #" + (findObjs({
                    _type: "character",
                    controlledby: "all"
                }).length + 1);
        DSBUILD.player = msg.who;
        sendChat("API", "/roll 1t[DS-Skills]", function (result) {
            let content = JSON.parse(result[0].content);
            let values = content.rolls[0].results[0].tableItem.name.split(':');
            DSBUILD.Class = values[0];
            DSBUILD.Skill1 = content.rolls[0].results[0].tableItem.name;
            DSBUILD.output['Class'] = "<tr><td style='font-weight: bold; padding: 5px;'>Class</td></tr><tr><td style='padding: 5px;'>" + DSBUILD.Class + "</td></tr>";
            DSText1 = "<table font-size: 10px;'> <tbody>" + DSBUILD.output['Class'] + "</tbody></table>";
            sendChat(msg.who, "/w gm " + DSText1);
        });

    },

    NPCSkills: function (msg) {
        sendChat("API", "/roll 1t[DS-Skills]", function (result) {
            let content = JSON.parse(result[0].content);
            let values = content.rolls[0].results[0].tableItem.name.split(':');
            DSBUILD.Class1 = values[0];
            DSBUILD.Skill1 = content.rolls[0].results[0].tableItem.name;
            DSBUILD.output['Skill1'] = "<tr><td style='font-weight: bold; padding: 5px;'>Skill1</td></tr><tr><td style='padding: 5px;'>" + DSBUILD.Skill1 + "</td></tr>";
            DSText3 = "<table font-size: 10px;'> <tbody>" + DSBUILD.output['Skill1'] + "</tbody></table>";
            sendChat(msg.who, "/w gm " + DSText3);
        });

        sendChat("API", "/roll 1t[DS-Skills]", function (result) {
            let content = JSON.parse(result[0].content);
            let values = content.rolls[0].results[0].tableItem.name.split(':');
            DSBUILD.trash = values[0];
            DSBUILD.Skill2 = content.rolls[0].results[0].tableItem.name;
            DSBUILD.output['Skill2'] = "<tr><td style='font-weight: bold; padding: 5px;'>Skill2</td></tr><tr><td style='padding: 5px;'>" + DSBUILD.Skill2 + "</td></tr>";
            DSText4 = "<table font-size: 10px;'> <tbody>" + DSBUILD.output['Skill2'] + "</tbody></table>";
            sendChat(msg.who, "/w gm " + DSText4);
        });
        sendChat("API", "/roll 1t[DS-Skills]", function (result) {
            let content = JSON.parse(result[0].content);
            let values = content.rolls[0].results[0].tableItem.name.split(':');
            DSBUILD.trash = values[0];
            DSBUILD.Skill3 = content.rolls[0].results[0].tableItem.name;
            DSBUILD.output['Skill3'] = "<tr><td style='font-weight: bold; padding: 5px;'>Skill3</td></tr><tr><td style='padding: 5px;'>" + DSBUILD.Skill3 + "</td></tr>";
            DSText5 = "<table font-size: 10px;'> <tbody>" + DSBUILD.output['Skill3'] + "</tbody></table>";
            sendChat(msg.who, "/w gm " + DSText5);
        });
        sendChat("API", "/roll 1t[DS-Skills]", function (result) {
            let content = JSON.parse(result[0].content);
            let values = content.rolls[0].results[0].tableItem.name.split(':');
            DSBUILD.trash = values[0];
            DSBUILD.Skill4 = content.rolls[0].results[0].tableItem.name;
            DSBUILD.output['Skill4'] = "<tr><td style='font-weight: bold; padding: 5px;'>Skill4</td></tr><tr><td style='padding: 5px;'>" + DSBUILD.Skill4 + "</td></tr>";
            DSText6 = "<table font-size: 10px;'> <tbody>" + DSBUILD.output['Skill4'] + "</tbody></table>";
            sendChat(msg.who, "/w gm " + DSText6);
        });
    },

    NPCLoadout: function (msg) {
        sendChat("API", "/roll 1t[DS-Loadout]", function (result) {
            let content = JSON.parse(result[0].content);
            let values = content.rolls[0].results[0].tableItem.name.split('-');
            DSBUILD.Loadout = values[0];
            DSBUILD.output['Loadout'] = "<tr><td style='font-weight: bold; padding: 5px;'>Personality</td></tr><tr><td style='padding: 5px;'>" + DSBUILD.Loadout + "</td></tr>";
            DSText7 = "<table font-size: 10px;'> <tbody>" + DSBUILD.output['Loadout'] + "</tbody></table>";
            sendChat(msg.who, "/w gm " + DSText7);
        });

    },

    printSheet: function (msg) {
        let styleLabel = "style='font-weight: bold; padding: 5px;'";
        let styleVal = "style='padding: 5px;'";

        DSBUILD.output['Instructions'] = "<tr><td style='font-weight: bold; padding: 5px;'>Instructions</td></tr><tr><td style='padding: 5px;'>Follow these instructions to complete the character according to the options selected.</td></tr>";

        DSText = "<p><p>CURRENT CHARACTER PARAMETERS<p><p>" +
            "<table font-size: 10px;'> <tbody>" +
            DSBUILD.output['Class'] +
            DSBUILD.output['Skill1'] +
            DSBUILD.output['Skill2'] +
            DSBUILD.output['Skill3'] +
            DSBUILD.output['Skill4'] +
            DSBUILD.output['Loadout'] + "</tbody></table>";

        sendChat(msg.who, "/w gm <p><p>" + DSText + "<p><p>");

    },

    save: function (msg) {
        sendChat(msg.who, "/w gm saving character");
        let character = createObj("character", {
            name: DSBUILD.name,
            archived: false,
            inplayerjournals: "all",
            controlledby: "all"
        });

        createObj('attribute', {
            name: 'character_player_name',
            current: DSBUILD.player,
            _characterid: character.id
        });
        createObj('attribute', {
            name: 'character_class',
            current: DSBUILD.Class,
            _characterid: character.id
        });
        switch (DSBUILD.Skill1) {
            // Teamster
        case 'Scavenging':
            createObj('attribute', {
                name: 'character_Scavanging',
                current: on,
                _characterid: character.id
            });
        case 'Melee Combat':
            createObj('attribute', {
                name: 'character_Melee',
                current: on,
                _characterid: character.id
            });
        case 'Vehicular Driving':
            createObj('attribute', {
                name: 'character_Driving',
                current: on,
                _characterid: character.id
            });
        case 'Heavy Machinery':
            createObj('attribute', {
                name: 'character_Heavy',
                current: on,
                _characterid: character.id
            });
        case 'Rinwise':
            createObj('attribute', {
                name: 'character_Rinwise',
                current: on,
                _characterid: character.id
            });
        case 'Zero-G':
            createObj('attribute', {
                name: 'character_Zero-G',
                current: on,
                _characterid: character.id
            });
        case 'Mechanical Repair':
            createObj('attribute', {
                name: 'character_Mechanical',
                current: on,
                _characterid: character.id
            });
        case 'Engineering':
            createObj('attribute', {
                name: 'character_Engineering',
                current: on,
                _characterid: character.id
            });
            // Marine
        case 'Athletics':
            createObj('attribute', {
                name: 'character_Athletics',
                current: on,
                _characterid: character.id
            });
        case 'Firearms':
            createObj('attribute', {
                name: 'character_Firearms',
                current: on,
                _characterid: character.id
            });
        case 'Piloting Ships':
            createObj('attribute', {
                name: 'character_Piloting',
                current: on,
                _characterid: character.id
            });
        case 'Gunnery':
            createObj('attribute', {
                name: 'character_Gunnery',
                current: on,
                _characterid: character.id
            });
        case 'Field Tactics':
            createObj('attribute', {
                name: 'character_Field',
                current: on,
                _characterid: character.id
            });
        case 'Command':
            createObj('attribute', {
                name: 'character_Command',
                current: on,
                _characterid: character.id
            });
        case 'Infiltration':
            createObj('attribute', {
                name: 'character_Infiltration',
                current: on,
                _characterid: character.id
            });
        case 'Explosives':
            createObj('attribute', {
                name: 'character_Explosives',
                current: on,
                _characterid: character.id
            });
            // Android
        case 'Linguistics':
            createObj('attribute', {
                name: 'character_Linguistics',
                current: on,
                _characterid: character.id
            });
        case 'Sophontology':
            createObj('attribute', {
                name: 'character_Sophontology',
                current: on,
                _characterid: character.id
            });
        case 'Informatics':
            createObj('attribute', {
                name: 'character_Informatics',
                current: on,
                _characterid: character.id
            });
        case 'Cybernetics':
            createObj('attribute', {
                name: 'character_Cybernetics',
                current: on,
                _characterid: character.id
            });
        case 'Sensors':
            createObj('attribute', {
                name: 'character_Sensors',
                current: on,
                _characterid: character.id
            });
        case 'Astrogation':
            createObj('attribute', {
                name: 'character_Astrogation',
                current: on,
                _characterid: character.id
            });
        case 'Hyperspace':
            createObj('attribute', {
                name: 'character_Hyperspace',
                current: on,
                _characterid: character.id
            });
        case 'Cryogenics':
            createObj('attribute', {
                name: 'character_Cryogenics',
                current: on,
                _characterid: character.id
            });
        default:
            return;
        }
        /*         createObj('attribute', {
        name: 'character_Loadout',
        current: DSBUILD.Loadout,
        _characterid: character.id
        }); */
        sendChat('', 'Created <a href="http://journal.roll20.net/character/' + character.id + '" style="color:blue;text-decoration:underline;">DSBUILD ' + DSBUILD.name + '</a>');

    }
};
on("ready", function () {
    DSBUILD.listen();
});

and here is the sheet code

<h1 align="center">DARKSHIP CHARACTER SHEET</h1><br>
	<!-- <h2>1. Come up with a name and a background.</h2> -->
 	<table style="width:100%">
		<tbody>
			<tr>
				</td>
				<td style="width:5%" align="right">
				</td>
				<td style="width:50%">
						<label>Name / Handle</label>
						<input type="text" name="attr_character_name"/><input type="number" name="attr_INIT" value="1">>
				</td>
				<td style="width:50%">
						<label>Background</label>
						<input type="text" name="attr_background"/>
				</td>
			</tr>
        </tbody>
		</table><hr>
 	<table style="width:100%">
		<tbody>
		    <tr>
				<td style="width:5%" align="right"></td>
				<td style="width:35%">
						<label>Armor/Wounds</label>
						<p style="background-color:LightSkyBlue;"><input type="radio" name="attr_character_wound" value="-2">   <b>Absorbed by Standard Battle Dress</b></p>
						<p style="background-color:LightSkyBlue;"><input type="radio" name="attr_character_wound" value="-1">   <b>Absorbed by Advanced Battle Dress</b></p>
						<input type="radio" name="attr_character_wound" value="0" checked>   None</p>
						<p style="background-color:LightGreen;"><input type="radio" name="attr_character_wound" value="1">   <b>Grazed</b></p>
						<p style="background-color:Orange;"><input type="radio" name="attr_character_wound" value="2">   <b>Wounded.</b> Increase difficulties for all physical tasks.</p>
						<p style="background-color:Tomato;"><input type="radio" name="attr_character_wound" value="3">   <b>Incapacitated.</b> Will die at the end of the scene unless they are stabilized successfully by a medical expert.</p>

				</td>
				<td style="width:5%" align="right">
				</td>
				<td style="width:35%">
					<label>Mishaps</label>
					<b>Whenever you push yourself and obtain a result of 1 on the Stress Die a mishap occurs.</b><br>
					<label>Stress</label>
					<input type="radio" name="attr_character_stress" value="0" checked>   None
					<input type="radio" name="attr_character_stress" value="1">
					<input type="radio" name="attr_character_stress" value="2">
					<input type="radio" name="attr_character_stress" value="3">
					<input type="radio" name="attr_character_stress" value="4">
					<input type="radio" name="attr_character_stress" value="5">
					<input type="radio" name="attr_character_stress" value="6"><br><br>
					<ul>
					    <li><b>Your Stress Level will begin at 0.</b> </li>
					    <li><b>Whenever the Stress Die shows a result higher than your Stress Level, increase it by one point</b></li>
					</ul>		
				</td>
				<td style="width:10%" align="right">
				</td>
			</tr>
        </tbody>
		</table><hr>
	<table style="width:95%">
		<tbody>
			<tr>
				<td style="width:5%" align="left">
				</td>
				<td style="width:45%" align="left">
				</td>
				<td style="width:5%" align="right">
				<td style="width:45%" align="left">
				</td>
				<td style="width:5%" align="right">
				</td>
            </tr>
            <tr></tr>
				<td style="width:5%" align="right">
				</td>
				<td style="width:45%" align="left">
					<label>Panic Effect</label>
					<b>Panic Checks require a single d6 roll. If the result is higher than your Stress Level
                    you get a grip of yourself and keep control of the situation while regulating your
                    breathing pattern. If it’s equal or below your Stress Level compare it against the Table
                    for Panic effects below. If your Stress is 0, rise it to 1 and ignore the Panic Check. </b><br>
					<button type="roll" value="%{name=@{selected|character_name|Panic-Check}" name="roll_Panic-Check">Panic Check</button>
					<button type="roll" value="&{template:default} {{name=%{selected|character_name}}} {{Base=[[1d6]]}} {{Skill=?{Use Skill?|No,0|Yes,[[1d6]]}}} {{Push=?{Push?|No,0|Yes,[[1d6]]}}} {{Difficulty=?{Difficulty?|Medium,Medium 4|Hard,Hard 5|Very Hard,Very Hard 6}}}" name="roll_fight">   Do Something</button>
				</td>
				<td style="width:5%" align="right">
				</td>
				<td style="width:45%" "rowspan=2">
						<input type="radio" name="attr_character_panic" value="0" checked>None <br>
	    				<input type="radio" name="attr_character_panic" value="1">   <b>Adrenaline Rush.</b> Increased difficulty of non-violent tasks. Lasts a scene.<br>
	    				<input type="radio" name="attr_character_panic" value="2">   <b>Hyperventilation.</b> Increased difficulty for all tasks. Lasts the rest of the scene.<br>
	    				<input type="radio" name="attr_character_panic" value="3">   <b>Scream.</b> Increase Stress Level by one. Nearby crew members make a Panic Check. <br>
	    				<input type="radio" name="attr_character_panic" value="4">   <b>Crippling Fear.</b> The character is incapacitated for the rest of the scene.
50% chance of gaining a new phobia. Recurring nightmares for 1d6 days. <br>
	    				<input type="radio" name="attr_character_panic" value="5">   <b>Psychotic.</b> Attack the nearest crew member, if there is none attack the environment. Lasts a scene. 50% chance of acquiring a nervous twitch.<br>
				</td>
				<td style="width:5%" align="right">
			</tr>
		</tbody>
	</table>
	<hr>
<h2>2. Pick a class and three skills from that class.</h2>
	<table style="width:100%">
		<tbody>
			<tr>
				</td>
				<td style="width:5%" align="right">
				</td>
				<td>
				<h3>   <input type="radio" name="attr_character_class" value="Teamster">   Teamster</h3>
				<td>
						<input type="checkbox" name="attr_character_Scavanging">   Scavanging
					</div>
				</td>
			   <td>
						<input type="checkbox" name="attr_character_Driving">   Vehicular Driving
					</div>
			   <td>
						<input type="checkbox" name="attr_character_Rinwise">   Rinwise
					</div>
			   <td>
						<input type="checkbox" name="attr_character_Mechanical">   Mechanical Repair
			</tr>
         <tr>
				</td>
				<td style="width:5%" align="right">
				</td>
			<td>
       <tr>
				</td>
				<td style="width:5%" align="right">
				</td>
			<td>
			</td>
            <td>
					<input type="checkbox" name="attr_character_Melee">   Melee Combat
			</td>
           <td>
 					<input type="checkbox" name="attr_character_Heavy">   Heavy Machinery
           <td>
                <div>
					<input type="checkbox" name="attr_character_Zero-G">   Zero-G
				</div>
           <td>
                <div>
					<input type="checkbox" name="attr_character_Engineering">   Engineering</label>
				</div>
		</tr>
        <tr>
				</td>
				<td style="width:5%" align="right">
				</td>
			<td><br>
			</td>
		</tr>
        <tr>
				</td>
				<td style="width:5%" align="right">
				</td>
			<td>
				<h3>   <input type="radio" name="attr_character_class" value="Marine">   Marine</h3>
			</td>
            <td>
					<input type="checkbox" name="attr_character_Athletics">   Athletics
			</td>
           <td>
					<input type="checkbox" name="attr_character_Piloting">   Piloting Ships
           <td>
					<input type="checkbox" name="attr_character_Field">   Field Tactics
           <td>
					<input type="checkbox" name="attr_character_Infiltration">   Infiltration
		</tr>
        <tr>
				</td>
				<td style="width:5%" align="right">
				</td>
			<td><br>
			</td>
            <td>
					<input type="checkbox" name="attr_character_Firearms">   Firearms
			</td>
           <td>
 					<input type="checkbox" name="attr_character_Gunnery">   Gunnery
          <td>
 					<input type="checkbox" name="attr_character_Command">   Command
          <td>
 					<input type="checkbox" name="attr_character_Explosives">   Explosives
		</tr>
        <tr>
			<td><br>
			</td>
		</tr>
        <tr>
				</td>
				<td style="width:5%" align="right">
				</td>
			<td>
				<h3>   <input type="radio" name="attr_character_class" value="Scientist">   Scientist</h3>
			</td>
            <td>
					<input type="checkbox" name="attr_character_Medicine">   Medicine
			</td>
           <td>
 					<input type="checkbox" name="attr_character_Theology">   Theology
          <td>
					<input type="checkbox" name="attr_character_Geology">   Geology
          <td>
 					<input type="checkbox" name="attr_character_Chemistry">   Chemistry
		</tr>
        <tr>
				</td>
				<td style="width:5%" align="right">
				</td>
			<td><br>
			</td>
           <td>
					<input type="checkbox" name="attr_character_Psychology">   Psychology
			</td>
           <td>
 					<input type="checkbox" name="attr_character_Archaeology">   Archaeology
           <td>
					<input type="checkbox" name="attr_character_Astronomy">   Astronomy
           <td>
					<input type="checkbox" name="attr_character_Biology">   Biology
		</tr>
        <tr>
			<td><br>
			</td>
		</tr>
        <tr>
				</td>
				<td style="width:5%" align="right">
				</td>
			<td>
				<h3>   <input type="radio" name="attr_character_class" value="Android">   Android</h3>
			</td>
            <td>
					<input type="checkbox" name="attr_character_Linguistics">   Linguistics
			</td>
           <td>
 					<input type="checkbox" name="attr_character_Informatics">   Informatics
          <td>
 					<input type="checkbox" name="attr_character_Sensors">   Sensors
           <td>
					<input type="checkbox" name="attr_character_Hyperspace">   Hyperspace
		</tr>
        <tr>
				</td>
				<td style="width:5%" align="right">
				</td>
			<td><br>
			</td>
            <td>
 					<input type="checkbox" name="attr_character_Sophontology">   Sophontology
			</td>
           <td>
 					<input type="checkbox" name="attr_character_Cybernetics">   Cybernetics
          <td>
					<input type="checkbox" name="attr_character_Astrogation">   Astrogation
          <td>
  					<input type="checkbox" name="attr_character_Cryogenics">   Cryogenics
		</tr>
		</tbody>
		</table><hr>

	<h2>3. Pick any other skill related to your background.</h2>
    <hr>
	<h2>4. Pick your Loadout.</h2>
		<table style="width:95%">
      		<tr>
				<td style="width:5%" align="right"></td>
				<td vertical-align: top; colspan="2"><input type="radio" name="attr_character_Loadout" value="0" checked>None<hr>
				</td>
			</tr>
      		<tr>
				<td style="width:5%" align="right">
				</td>
				<td vertical-align: top; colspan="2">
					<input type="radio" name="attr_character_Loadout" value="1">
					<b>EXCAVATION:</b><br><br><b>WEAPONS: </b>Crowbar(L), Hand Welder(M)<br><b>PROTECTION: </b>Vaccsuit (Oxygen Tank, Mag-Boots, Short-range Comms)<br><b>EQUIPMENT: </b>Body Cam, Bioscanner, Infrared Goggles, Lockpick Set<hr>
       			</td>
			</tr>
       		<tr>
				<td style="width:5%" align="right">
				</td>
				<td vertical-align: top; colspan="2">
					<input type="radio" name="attr_character_Loadout" value="2">
					<b>EXPLORATION:</b><br><br><b>WEAPONS: </b>Vibechete(M), Flare Gun(L)<br><b>PROTECTION: </b>Vaccsuit (Long-range Comms, Oxygen Tank)<br><b>EQUIPMENT: </b>First Aid Kit, Survey Kit, Water Filter, Locator, Rebreather, Binoculars, Flashlight, Camping Gear, MREs x7<hr>
       			</td>
			</tr>
      		<tr>
					<td style="width:5%" align="right">
				</td>
			<td vertical-align: top; colspan="2">
					<input type="radio" name="attr_character_Loadout" value="3">
					<b>EXTERMINATION:</b><br><br><b>WEAPONS: </b>SMG(L), Frag Grenade(H) x6<br><b>PROTECTION: </b>Standard Battle Dress (Heads-up Display, Body Cam, Short-range Comms)<br><b>EQUIPMENT: </b>Stimpak x6, Electronic Tool Kit<hr>
       			</td>
			</tr>
      		<tr>
				<td style="width:5%" align="right">
				</td>
				<td vertical-align: top; colspan="2">
					<input type="radio" name="attr_character_Loadout" value="4">
					<b>EXAMINATION:</b><br><br><b>WEAPONS: </b>Scalpel(L), Tranq Pistol(MNL), Stun Baton(M)<br><b>PROTECTION: </b>Hazard Suit<br><b>EQUIPMENT: </b>Medscanner, Automed x6, Pain Pills x6, Stimpak x6, Cybernetic Diagnostic Scanner<hr>
       			</td>
			</tr>
      		<tr>
				<td style="width:5%" align="right">
				</td>
				<td vertical-align: top;>
					<input type="radio" name="attr_character_Loadout" value="5">
					<b>CUSTOM:   </b><textarea name="attr_custom_loadout"></textarea></td>
			</tr><hr>
      		<tr>
				<td vertical-align: top;>
					<h2>NOTES:</h2></tr>
      		<tr>
				<td style="width:5%" align="right"></td>
                <td><textarea name="attr_notes"></textarea></td>
			</tr>
 		</table>
	</div>
I've only ever used CreateObj. I haven't seen another command to update existing objects.



September 24 (1 year ago)

Edited September 24 (1 year ago)
The Aaron
Roll20 Production Team
API Scripter

In the cases where you are calling this:

            createObj('attribute', {
                name: 'character_Scavanging',
                current: on,
                _characterid: character.id
            });

In the code above, on is a variable with the value undefined.  If you want to set the value to match what the sheet uses, you need this:

            createObj('attribute', {
                name: 'character_Scavanging',
                current: 'on',
                _characterid: character.id
            });

In the code above, 'on' is a string literal, which is the same value the character sheet uses for checkboxes that are checked.

Find all the places where you have the variable on and replace them with the string literal 'on'.

September 24 (1 year ago)
Joab
Pro

I did that, and no change.

/**
 * Generates DarkShip Characters
 *
 * Syntax: !DSGen option
 *
 */

var DSBUILD = DSBUILD || {
    version: "0.0.4",
    output: [],

    listen: function () {
        on('chat:message', function (msg) {
            // Exit if not an api command
            if (msg.type != "api") {
                return;
            }
            if (msg.content.indexOf("!DSGen ") != -1) {
                var input = msg.content.split(" ");
                if (input[1] == "help") {
                    DSBUILD.showHelp();
                } else {
                    sendChat('API', "/direct <h6>Generating character</h6>");
                    DSBUILD.Generate(msg, DSBUILD.printSheet, DSBUILD.save);
                }
            } else if (msg.content.indexOf("!DSGen") != -1) {
                DSBUILD.showHelp();
            }
        });
    },

    showHelp: function () {
        sendChat("API", "/w gm <table style='background: #DCD9D5; border-radius: 20px; font-size: 10px;'>" +
            "<thead><tr><th>Help</th></tr></thead>" +
            "<tbody>" +
            "<tr><td><strong>!DSBUILD</strong><br><strong>!fodder help</strong><br>Show this help screen.</td></tr>" +
            "<tr><td><strong>!DSBUILD core</strong><br>Runs the script.</td></tr>" +
            "<tr><td> </td></tr>" +
            "</td></tr></tbody></table>");
    },

    Generate: function (msg, outputCallback, saveCallback) {
        DSBUILD.id = msg.playerid;
        DSBUILD.player = msg.who;
        DSBUILD.name = msg.who + " #" + (findObjs({
                    _type: "character",
                    controlledby: msg.playerid
                }).length + 1)
        DSBUILD.NPCClass(msg);
        DSBUILD.NPCSkills(msg);
        DSBUILD.NPCLoadout(msg);
        if (typeof outputCallback === "function") {
            setTimeout(outputCallback, 2500, msg, saveCallback);
        }
    },

    NPCClass: function (msg) {
        DSBUILD.id = msg.playerid;
        DSBUILD.name = msg.who + " #" + (findObjs({
                    _type: "character",
                    controlledby: "all"
                }).length + 1);
        DSBUILD.player = msg.who;
        sendChat("API", "/roll 1t[DS-Skills]", function (result) {
            let content = JSON.parse(result[0].content);
            let values = content.rolls[0].results[0].tableItem.name.split(':');
            DSBUILD.Class = values[0];
            DSBUILD.Skill1 = content.rolls[0].results[0].tableItem.name;
            DSBUILD.output['Class'] = "<tr><td style='font-weight: bold; padding: 5px;'>Class</td></tr><tr><td style='padding: 5px;'>" + DSBUILD.Class + "</td></tr>";
            DSText1 = "<table font-size: 10px;'> <tbody>" + DSBUILD.output['Class'] + "</tbody></table>";
            sendChat(msg.who, "/w gm " + DSText1);
        });

    },

    NPCSkills: function (msg) {
        sendChat("API", "/roll 1t[DS-Skills]", function (result) {
            let content = JSON.parse(result[0].content);
            let values = content.rolls[0].results[0].tableItem.name.split(':');
            DSBUILD.Class1 = values[0];
            DSBUILD.Skill1 = values[1];
            DSBUILD.output['Skill1'] = "<tr><td style='font-weight: bold; padding: 5px;'>Skill1</td></tr><tr><td style='padding: 5px;'>" + DSBUILD.Skill1 + "</td></tr>";
            DSText3 = "<table font-size: 10px;'> <tbody>" + DSBUILD.output['Skill1'] + "</tbody></table>";
            sendChat(msg.who, "/w gm " + DSText3);
        });

        sendChat("API", "/roll 1t[DS-Skills]", function (result) {
            let content = JSON.parse(result[0].content);
            let values = content.rolls[0].results[0].tableItem.name.split(':');
            DSBUILD.trash = values[0];
            DSBUILD.Skill2 = values[1];
            DSBUILD.output['Skill2'] = "<tr><td style='font-weight: bold; padding: 5px;'>Skill2</td></tr><tr><td style='padding: 5px;'>" + DSBUILD.Skill2 + "</td></tr>";
            DSText4 = "<table font-size: 10px;'> <tbody>" + DSBUILD.output['Skill2'] + "</tbody></table>";
            sendChat(msg.who, "/w gm " + DSText4);
        });
        sendChat("API", "/roll 1t[DS-Skills]", function (result) {
            let content = JSON.parse(result[0].content);
            let values = content.rolls[0].results[0].tableItem.name.split(':');
            DSBUILD.trash = values[0];
            DSBUILD.Skill3 = values[1];
            DSBUILD.output['Skill3'] = "<tr><td style='font-weight: bold; padding: 5px;'>Skill3</td></tr><tr><td style='padding: 5px;'>" + DSBUILD.Skill3 + "</td></tr>";
            DSText5 = "<table font-size: 10px;'> <tbody>" + DSBUILD.output['Skill3'] + "</tbody></table>";
            sendChat(msg.who, "/w gm " + DSText5);
        });
        sendChat("API", "/roll 1t[DS-Skills]", function (result) {
            let content = JSON.parse(result[0].content);
            let values = content.rolls[0].results[0].tableItem.name.split(':');
            DSBUILD.trash = values[0];
            DSBUILD.Skill4 = values[1];
            DSBUILD.output['Skill4'] = "<tr><td style='font-weight: bold; padding: 5px;'>Skill4</td></tr><tr><td style='padding: 5px;'>" + DSBUILD.Skill4 + "</td></tr>";
            DSText6 = "<table font-size: 10px;'> <tbody>" + DSBUILD.output['Skill4'] + "</tbody></table>";
            sendChat(msg.who, "/w gm " + DSText6);
        });
    },

    NPCLoadout: function (msg) {
        sendChat("API", "/roll 1t[DS-Loadout]", function (result) {
            let content = JSON.parse(result[0].content);
            let values = content.rolls[0].results[0].tableItem.name.split('-');
            DSBUILD.Loadout = values[0];
            DSBUILD.output['Loadout'] = "<tr><td style='font-weight: bold; padding: 5px;'>Personality</td></tr><tr><td style='padding: 5px;'>" + DSBUILD.Loadout + "</td></tr>";
            DSText7 = "<table font-size: 10px;'> <tbody>" + DSBUILD.output['Loadout'] + "</tbody></table>";
            sendChat(msg.who, "/w gm " + DSText7);
        });

    },

    printSheet: function (msg) {
        let styleLabel = "style='font-weight: bold; padding: 5px;'";
        let styleVal = "style='padding: 5px;'";

        DSBUILD.output['Instructions'] = "<tr><td style='font-weight: bold; padding: 5px;'>Instructions</td></tr><tr><td style='padding: 5px;'>Follow these instructions to complete the character according to the options selected.</td></tr>";

        DSText = "<p><p>CURRENT CHARACTER PARAMETERS<p><p>" +
            "<table font-size: 10px;'> <tbody>" +
            DSBUILD.output['Class'] +
            DSBUILD.output['Skill1'] +
            DSBUILD.output['Skill2'] +
            DSBUILD.output['Skill3'] +
            DSBUILD.output['Skill4'] +
            DSBUILD.output['Loadout'] + "</tbody></table>";

        sendChat(msg.who, "/w gm <p><p>" + DSText + "<p><p>");

    },

    save: function (msg) {
        sendChat(msg.who, "/w gm saving character");
        let character = createObj("character", {
            name: DSBUILD.name,
            archived: false,
            inplayerjournals: "all",
            controlledby: "all"
        });
        createObj('attribute', {
            name: 'character_player_name',
            current: DSBUILD.player,
            _characterid: character.id
        });
        createObj('attribute', {
            name: 'character_class',
            current: DSBUILD.Class,
            _characterid: character.id
        });
        switch (DSBUILD.Skill1) {
            // Teamster
        case 'Scavenging':
            createObj('attribute', {
                name: 'character_Scavenging',
                current: 'on',
                _characterid: character.id
            });
		break;
        case 'Melee Combat':
            createObj('attribute', {
                name: 'character_Melee',
                current: 'on',
                _characterid: character.id
            });
        case 'Vehicular Driving':
            createObj('attribute', {
                name: 'character_Driving',
                current: 'on',
                _characterid: character.id
            });
		break;
        case 'Heavy Machinery':
            createObj('attribute', {
                name: 'character_Heavy',
                current: 'on',
                _characterid: character.id
            });
		break;
        case 'Rinwise':
            createObj('attribute', {
                name: 'character_Rinwise',
                current: 'on',
                _characterid: character.id
            });
		break;
        case 'Zero-G':
            createObj('attribute', {
                name: 'character_Zero-G',
                current: 'on',
                _characterid: character.id
            });
		break;
        case 'Mechanical Repair':
            createObj('attribute', {
                name: 'character_Mechanical',
                current: 'on',
                _characterid: character.id
            });
		break;
        case 'Engineering':
            createObj('attribute', {
                name: 'character_Engineering',
                current: 'on',
                _characterid: character.id
            });
            // Marine
		break;
        case 'Athletics':
            createObj('attribute', {
                name: 'character_Athletics',
                current: 'on',
                _characterid: character.id
            });
		break;
        case 'Firearms':
            createObj('attribute', {
                name: 'character_Firearms',
                current: 'on',
                _characterid: character.id
            });
		break;
        case 'Piloting Ships':
            createObj('attribute', {
                name: 'character_Piloting',
                current: 'on',
                _characterid: character.id
            });
		break;
        case 'Gunnery':
            createObj('attribute', {
                name: 'character_Gunnery',
                current: 'on',
                _characterid: character.id
            });
		break;
        case 'Field Tactics':
            createObj('attribute', {
                name: 'character_Field',
                current: 'on',
                _characterid: character.id
            });
		break;
        case 'Command':
            createObj('attribute', {
                name: 'character_Command',
                current: 'on',
                _characterid: character.id
            });
        case 'Infiltration':
            createObj('attribute', {
                name: 'character_Infiltration',
                current: 'on',
                _characterid: character.id
            });
		break;
        case 'Explosives':
            createObj('attribute', {
                name: 'character_Explosives',
                current: 'on',
                _characterid: character.id
            });
            // Scientist
		break;
        case 'Medicine':
            createObj('attribute', {
                name: 'character_Medicine',
                current: 'on',
                _characterid: character.id
            });
		break;
        case 'Psychology':
            createObj('attribute', {
                name: 'character_Psychology',
                current: 'on',
                _characterid: character.id
            });
		break;
        case 'Theology':
            createObj('attribute', {
                name: 'character_Theology',
                current: 'on',
                _characterid: character.id
            });
		break;
        case 'Archaeology':
            createObj('attribute', {
                name: 'character_Archaeology',
                current: 'on',
                _characterid: character.id
            });
		break;
        case 'Geology':
            createObj('attribute', {
                name: 'character_Geology',
                current: 'on',
                _characterid: character.id
            });
		break;
        case 'Astronomy':
            createObj('attribute', {
                name: 'character_Astronomy',
                current: 'on',
                _characterid: character.id
            });
		break;
        case 'Chemistry':
            createObj('attribute', {
                name: 'character_Chemistry',
                current: 'on',
                _characterid: character.id
            });
		break;
        case 'Biology':
            createObj('attribute', {
                name: 'character_Biology',
                current: 'on',
                _characterid: character.id
            });
            // Android
		break;
        case 'Linguistics':
            createObj('attribute', {
                name: 'character_Linguistics',
                current: 'on',
                _characterid: character.id
            });
		break;
        case 'Sophontology':
            createObj('attribute', {
                name: 'character_Sophontology',
                current: 'on',
                _characterid: character.id
            });
		break;
        case 'Informatics':
            createObj('attribute', {
                name: 'character_Informatics',
                current: 'on',
                _characterid: character.id
            });
		break;
        case 'Cybernetics':
            createObj('attribute', {
                name: 'character_Cybernetics',
                current: 'on',
                _characterid: character.id
            });
		break;
        case 'Sensors':
            createObj('attribute', {
                name: 'character_Sensors',
                current: 'on',
                _characterid: character.id
            });
		break;
        case 'Astrogation':
            createObj('attribute', {
                name: 'character_Astrogation',
                current: 'on',
                _characterid: character.id
            });
		break;
        case 'Hyperspace':
            createObj('attribute', {
                name: 'character_Hyperspace',
                current: 'on',
                _characterid: character.id
            });
		break;
        case 'Cryogenics':
            createObj('attribute', {
                name: 'character_Cryogenics',
                current: 'on',
                _characterid: character.id
            });
        default:
            return;
        }
        switch (DSBUILD.Skill2) {
            // Teamster
        case 'Scavenging':
            createObj('attribute', {
                name: 'character_Scavenging',
                current: 'on',
                _characterid: character.id
            });
		break;
        case 'Melee Combat':
            createObj('attribute', {
                name: 'character_Melee',
                current: 'on',
                _characterid: character.id
            });
        case 'Vehicular Driving':
            createObj('attribute', {
                name: 'character_Driving',
                current: 'on',
                _characterid: character.id
            });
		break;
        case 'Heavy Machinery':
            createObj('attribute', {
                name: 'character_Heavy',
                current: 'on',
                _characterid: character.id
            });
		break;
        case 'Rinwise':
            createObj('attribute', {
                name: 'character_Rinwise',
                current: 'on',
                _characterid: character.id
            });
		break;
        case 'Zero-G':
            createObj('attribute', {
                name: 'character_Zero-G',
                current: 'on',
                _characterid: character.id
            });
		break;
        case 'Mechanical Repair':
            createObj('attribute', {
                name: 'character_Mechanical',
                current: 'on',
                _characterid: character.id
            });
		break;
        case 'Engineering':
            createObj('attribute', {
                name: 'character_Engineering',
                current: 'on',
                _characterid: character.id
            });
            // Marine
		break;
        case 'Athletics':
            createObj('attribute', {
                name: 'character_Athletics',
                current: 'on',
                _characterid: character.id
            });
		break;
        case 'Firearms':
            createObj('attribute', {
                name: 'character_Firearms',
                current: 'on',
                _characterid: character.id
            });
		break;
        case 'Piloting Ships':
            createObj('attribute', {
                name: 'character_Piloting',
                current: 'on',
                _characterid: character.id
            });
		break;
        case 'Gunnery':
            createObj('attribute', {
                name: 'character_Gunnery',
                current: 'on',
                _characterid: character.id
            });
		break;
        case 'Field Tactics':
            createObj('attribute', {
                name: 'character_Field',
                current: 'on',
                _characterid: character.id
            });
		break;
        case 'Command':
            createObj('attribute', {
                name: 'character_Command',
                current: 'on',
                _characterid: character.id
            });
        case 'Infiltration':
            createObj('attribute', {
                name: 'character_Infiltration',
                current: 'on',
                _characterid: character.id
            });
		break;
        case 'Explosives':
            createObj('attribute', {
                name: 'character_Explosives',
                current: 'on',
                _characterid: character.id
            });
            // Scientist
		break;
        case 'Medicine':
            createObj('attribute', {
                name: 'character_Medicine',
                current: 'on',
                _characterid: character.id
            });
		break;
        case 'Psychology':
            createObj('attribute', {
                name: 'character_Psychology',
                current: 'on',
                _characterid: character.id
            });
		break;
        case 'Theology':
            createObj('attribute', {
                name: 'character_Theology',
                current: 'on',
                _characterid: character.id
            });
		break;
        case 'Archaeology':
            createObj('attribute', {
                name: 'character_Archaeology',
                current: 'on',
                _characterid: character.id
            });
		break;
        case 'Geology':
            createObj('attribute', {
                name: 'character_Geology',
                current: 'on',
                _characterid: character.id
            });
		break;
        case 'Astronomy':
            createObj('attribute', {
                name: 'character_Astronomy',
                current: 'on',
                _characterid: character.id
            });
		break;
        case 'Chemistry':
            createObj('attribute', {
                name: 'character_Chemistry',
                current: 'on',
                _characterid: character.id
            });
		break;
        case 'Biology':
            createObj('attribute', {
                name: 'character_Biology',
                current: 'on',
                _characterid: character.id
            });
            // Android
		break;
        case 'Linguistics':
            createObj('attribute', {
                name: 'character_Linguistics',
                current: 'on',
                _characterid: character.id
            });
		break;
        case 'Sophontology':
            createObj('attribute', {
                name: 'character_Sophontology',
                current: 'on',
                _characterid: character.id
            });
		break;
        case 'Informatics':
            createObj('attribute', {
                name: 'character_Informatics',
                current: 'on',
                _characterid: character.id
            });
		break;
        case 'Cybernetics':
            createObj('attribute', {
                name: 'character_Cybernetics',
                current: 'on',
                _characterid: character.id
            });
		break;
        case 'Sensors':
            createObj('attribute', {
                name: 'character_Sensors',
                current: 'on',
                _characterid: character.id
            });
		break;
        case 'Astrogation':
            createObj('attribute', {
                name: 'character_Astrogation',
                current: 'on',
                _characterid: character.id
            });
		break;
        case 'Hyperspace':
            createObj('attribute', {
                name: 'character_Hyperspace',
                current: 'on',
                _characterid: character.id
            });
		break;
        case 'Cryogenics':
            createObj('attribute', {
                name: 'character_Cryogenics',
                current: 'on',
                _characterid: character.id
            });
        default:
            return;
        }
        switch (DSBUILD.Skill3) {
            // Teamster
        case 'Scavenging':
            createObj('attribute', {
                name: 'character_Scavenging',
                current: 'on',
                _characterid: character.id
            });
		break;
        case 'Melee Combat':
            createObj('attribute', {
                name: 'character_Melee',
                current: 'on',
                _characterid: character.id
            });
        case 'Vehicular Driving':
            createObj('attribute', {
                name: 'character_Driving',
                current: 'on',
                _characterid: character.id
            });
		break;
        case 'Heavy Machinery':
            createObj('attribute', {
                name: 'character_Heavy',
                current: 'on',
                _characterid: character.id
            });
		break;
        case 'Rinwise':
            createObj('attribute', {
                name: 'character_Rinwise',
                current: 'on',
                _characterid: character.id
            });
		break;
        case 'Zero-G':
            createObj('attribute', {
                name: 'character_Zero-G',
                current: 'on',
                _characterid: character.id
            });
		break;
        case 'Mechanical Repair':
            createObj('attribute', {
                name: 'character_Mechanical',
                current: 'on',
                _characterid: character.id
            });
		break;
        case 'Engineering':
            createObj('attribute', {
                name: 'character_Engineering',
                current: 'on',
                _characterid: character.id
            });
            // Marine
		break;
        case 'Athletics':
            createObj('attribute', {
                name: 'character_Athletics',
                current: 'on',
                _characterid: character.id
            });
		break;
        case 'Firearms':
            createObj('attribute', {
                name: 'character_Firearms',
                current: 'on',
                _characterid: character.id
            });
		break;
        case 'Piloting Ships':
            createObj('attribute', {
                name: 'character_Piloting',
                current: 'on',
                _characterid: character.id
            });
		break;
        case 'Gunnery':
            createObj('attribute', {
                name: 'character_Gunnery',
                current: 'on',
                _characterid: character.id
            });
		break;
        case 'Field Tactics':
            createObj('attribute', {
                name: 'character_Field',
                current: 'on',
                _characterid: character.id
            });
		break;
        case 'Command':
            createObj('attribute', {
                name: 'character_Command',
                current: 'on',
                _characterid: character.id
            });
        case 'Infiltration':
            createObj('attribute', {
                name: 'character_Infiltration',
                current: 'on',
                _characterid: character.id
            });
		break;
        case 'Explosives':
            createObj('attribute', {
                name: 'character_Explosives',
                current: 'on',
                _characterid: character.id
            });
            // Scientist
		break;
        case 'Medicine':
            createObj('attribute', {
                name: 'character_Medicine',
                current: 'on',
                _characterid: character.id
            });
		break;
        case 'Psychology':
            createObj('attribute', {
                name: 'character_Psychology',
                current: 'on',
                _characterid: character.id
            });
		break;
        case 'Theology':
            createObj('attribute', {
                name: 'character_Theology',
                current: 'on',
                _characterid: character.id
            });
		break;
        case 'Archaeology':
            createObj('attribute', {
                name: 'character_Archaeology',
                current: 'on',
                _characterid: character.id
            });
		break;
        case 'Geology':
            createObj('attribute', {
                name: 'character_Geology',
                current: 'on',
                _characterid: character.id
            });
		break;
        case 'Astronomy':
            createObj('attribute', {
                name: 'character_Astronomy',
                current: 'on',
                _characterid: character.id
            });
		break;
        case 'Chemistry':
            createObj('attribute', {
                name: 'character_Chemistry',
                current: 'on',
                _characterid: character.id
            });
		break;
        case 'Biology':
            createObj('attribute', {
                name: 'character_Biology',
                current: 'on',
                _characterid: character.id
            });
            // Android
		break;
        case 'Linguistics':
            createObj('attribute', {
                name: 'character_Linguistics',
                current: 'on',
                _characterid: character.id
            });
		break;
        case 'Sophontology':
            createObj('attribute', {
                name: 'character_Sophontology',
                current: 'on',
                _characterid: character.id
            });
		break;
        case 'Informatics':
            createObj('attribute', {
                name: 'character_Informatics',
                current: 'on',
                _characterid: character.id
            });
		break;
        case 'Cybernetics':
            createObj('attribute', {
                name: 'character_Cybernetics',
                current: 'on',
                _characterid: character.id
            });
		break;
        case 'Sensors':
            createObj('attribute', {
                name: 'character_Sensors',
                current: 'on',
                _characterid: character.id
            });
		break;
        case 'Astrogation':
            createObj('attribute', {
                name: 'character_Astrogation',
                current: 'on',
                _characterid: character.id
            });
		break;
        case 'Hyperspace':
            createObj('attribute', {
                name: 'character_Hyperspace',
                current: 'on',
                _characterid: character.id
            });
		break;
        case 'Cryogenics':
            createObj('attribute', {
                name: 'character_Cryogenics',
                current: 'on',
                _characterid: character.id
            });
        default:
            return;
        }
        switch (DSBUILD.Skill4) {
            // Teamster
        case 'Scavenging':
            createObj('attribute', {
                name: 'character_Scavenging',
                current: 'on',
                _characterid: character.id
            });
		break;
        case 'Melee Combat':
            createObj('attribute', {
                name: 'character_Melee',
                current: 'on',
                _characterid: character.id
            });
        case 'Vehicular Driving':
            createObj('attribute', {
                name: 'character_Driving',
                current: 'on',
                _characterid: character.id
            });
		break;
        case 'Heavy Machinery':
            createObj('attribute', {
                name: 'character_Heavy',
                current: 'on',
                _characterid: character.id
            });
		break;
        case 'Rinwise':
            createObj('attribute', {
                name: 'character_Rinwise',
                current: 'on',
                _characterid: character.id
            });
		break;
        case 'Zero-G':
            createObj('attribute', {
                name: 'character_Zero-G',
                current: 'on',
                _characterid: character.id
            });
		break;
        case 'Mechanical Repair':
            createObj('attribute', {
                name: 'character_Mechanical',
                current: 'on',
                _characterid: character.id
            });
		break;
        case 'Engineering':
            createObj('attribute', {
                name: 'character_Engineering',
                current: 'on',
                _characterid: character.id
            });
            // Marine
		break;
        case 'Athletics':
            createObj('attribute', {
                name: 'character_Athletics',
                current: 'on',
                _characterid: character.id
            });
		break;
        case 'Firearms':
            createObj('attribute', {
                name: 'character_Firearms',
                current: 'on',
                _characterid: character.id
            });
		break;
        case 'Piloting Ships':
            createObj('attribute', {
                name: 'character_Piloting',
                current: 'on',
                _characterid: character.id
            });
		break;
        case 'Gunnery':
            createObj('attribute', {
                name: 'character_Gunnery',
                current: 'on',
                _characterid: character.id
            });
		break;
        case 'Field Tactics':
            createObj('attribute', {
                name: 'character_Field',
                current: 'on',
                _characterid: character.id
            });
		break;
        case 'Command':
            createObj('attribute', {
                name: 'character_Command',
                current: 'on',
                _characterid: character.id
            });
        case 'Infiltration':
            createObj('attribute', {
                name: 'character_Infiltration',
                current: 'on',
                _characterid: character.id
            });
		break;
        case 'Explosives':
            createObj('attribute', {
                name: 'character_Explosives',
                current: 'on',
                _characterid: character.id
            });
            // Scientist
		break;
        case 'Medicine':
            createObj('attribute', {
                name: 'character_Medicine',
                current: 'on',
                _characterid: character.id
            });
		break;
        case 'Psychology':
            createObj('attribute', {
                name: 'character_Psychology',
                current: 'on',
                _characterid: character.id
            });
		break;
        case 'Theology':
            createObj('attribute', {
                name: 'character_Theology',
                current: 'on',
                _characterid: character.id
            });
		break;
        case 'Archaeology':
            createObj('attribute', {
                name: 'character_Archaeology',
                current: 'on',
                _characterid: character.id
            });
		break;
        case 'Geology':
            createObj('attribute', {
                name: 'character_Geology',
                current: 'on',
                _characterid: character.id
            });
		break;
        case 'Astronomy':
            createObj('attribute', {
                name: 'character_Astronomy',
                current: 'on',
                _characterid: character.id
            });
		break;
        case 'Chemistry':
            createObj('attribute', {
                name: 'character_Chemistry',
                current: 'on',
                _characterid: character.id
            });
		break;
        case 'Biology':
            createObj('attribute', {
                name: 'character_Biology',
                current: 'on',
                _characterid: character.id
            });
            // Android
		break;
        case 'Linguistics':
            createObj('attribute', {
                name: 'character_Linguistics',
                current: 'on',
                _characterid: character.id
            });
		break;
        case 'Sophontology':
            createObj('attribute', {
                name: 'character_Sophontology',
                current: 'on',
                _characterid: character.id
            });
		break;
        case 'Informatics':
            createObj('attribute', {
                name: 'character_Informatics',
                current: 'on',
                _characterid: character.id
            });
		break;
        case 'Cybernetics':
            createObj('attribute', {
                name: 'character_Cybernetics',
                current: 'on',
                _characterid: character.id
            });
		break;
        case 'Sensors':
            createObj('attribute', {
                name: 'character_Sensors',
                current: 'on',
                _characterid: character.id
            });
		break;
        case 'Astrogation':
            createObj('attribute', {
                name: 'character_Astrogation',
                current: 'on',
                _characterid: character.id
            });
		break;
        case 'Hyperspace':
            createObj('attribute', {
                name: 'character_Hyperspace',
                current: 'on',
                _characterid: character.id
            });
		break;
        case 'Cryogenics':
            createObj('attribute', {
                name: 'character_Cryogenics',
                current: 'on',
                _characterid: character.id
            });
        default:
            return;
            }
/*             createObj('attribute', {
            name: 'character_Loadout',
            current: DSBUILD.Loadout,
            _characterid: character.id
        });
 */
    }
};
on("ready", function () {
    DSBUILD.listen();
});