After a good nights sleep, I figured that I didn't know how to write a function, and I wasn't going to find out any time soon, so I would rather re-write the trigger, so it didn't use said function. And now that it's done, I can add admirals.
Here's how I did it:
1.
Open the database as described by slowpoke2
2.
In the right side window, click on the Execute SQL-tab
3.
If it says something in the field Enter SQL, delete it, write/copy-paste:
DROP TRIGGER t_admirals
Click the Run SQL-button
It should run without errors.
4.
Clear the field again, write/copy-paste:
CREATE TRIGGER t_admirals AFTER INSERT ON admirals
BEGIN
INSERT OR IGNORE INTO gen_unique (generator, player_id)
VALUES ('admirals', (SELECT id FROM clientinfo WHERE ROWID = 1));
UPDATE gen_unique
SET current = current + 1
WHERE generator = 'admirals'
AND player_id = (SELECT id FROM clientinfo WHERE ROWID = 1);
UPDATE admirals SET id = (SELECT (
(~
(
(
(
SELECT current FROM gen_unique WHERE generator = 'admirals' AND player_id = (SELECT id FROM clientinfo WHERE ROWID = 1)
) << 4
) &
(
SELECT id FROM clientinfo WHERE ROWID = 1
)
)
)& (
(
(
SELECT current FROM gen_unique WHERE generator = 'admirals' AND player_id = (SELECT id FROM clientinfo WHERE ROWID = 1)
) << 4
) |
(
SELECT id FROM clientinfo WHERE ROWID = 1
)
)
)) WHERE ROWID = new.ROWID;
END
Click the Run SQL-button
It should run without errors
5.
Click on the Browse & Search-tab in the right side window, navigate to the admirals-table in the left side window, and click on it. The right side window should now show the information contained in the table. Click the Add-button in the right side window, and a new window should pop up, allowing you to add a new admiral.
6.
Now it's time to make an admiral!
1. id: Don't fill out this field, it will take care of it self.
2. player_id: Write your id (usually 1).
3. orbital_object_id: Write the id of one of your worlds (the simplest one would be your home world, which can be found in the players-table, under homeworld_id)
4. name: Write the new admirals desired name.
5. race: Write your race (hiver | human | tarka | morrigi | hordezuul | liir)
6. age: The admirals desired age (usually 40-something; lower and the game might act up)
7. gender: The admirals gender (female | male)
8. reaction: The admirals reaction (I don't really know what this does, but it shouldn't be higher than 99)
9. evasion: The admirals evasion (Don't know what this means either, but again, no higher than 99)
10. loyalty: The admirals loyalty (Same as the above, 99 tops)
11-15: Just set these to 0.
7.
Click the OK-button, and the window turns into a confirmation window. Press the OK-button again (It might not show up, but you can just press enter, or widen the window to find the button)
Repeat step 6-7 until you've made all the admirals you want.
8.
Close/save the database, as described by slowpoke2.