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

GURPS API question

1490886135

Edited 1490886211
OK, so I'm hoping I'm putting this on the correct forum, I am currently running a GURPS campaign and have just now started getting into the Macros and API scripting. I'm an extreme novice at this but I wanted to know if it is possible to create the below idea: I have several characters who have multiple types of attacks (different weapons etc.) so what I would like to accomplish is an attack button, which once clicked will bring up a drop down of each of the characters attack options (preferably pulling the information from the character sheet). Once they select the attack they are using, it will bring up a modifier prompt and then make the roll vs their skill. Is this something that is possible? And if so, how would I go about typing that up?
1490887045
The Aaron
Pro
API Scripter
It's possible to get something that works like that. Being an API guy, I'd probably create a series of API commands that output API Command Buttons with the correct options in them. Something like: !gurps-attacks @{selected|character_id} [choose](!gurps-attack CHARID ?{Which attack|Attack name 1,SOMEID1|Attack name 2,SOMEID2}) [chosen attack name]( whatever makes sense...) The first line is the initial command and would generate the subsequent command buttons, whispered to the player. There are some intricacies in the escaping of the commands, and some choices about what you'd want to do, but that's the basic concept. Of course, there's a big API script behind this you'd have to write. :)
1490888762

Edited 1490889076
What you want is a series of  Roll Queries in a Macro or Ability. Putting all the possible options for various attack forms in a single Macro or Ability would get VERY complicated, so you probably want to split it up. Here's a simple example of a single attack form (as an Ability for a Character with Attributes of Broadsword, Swing, and Thrust): /em attacks with a broadsword. Effective skill: [[ @{Broadsword} + ( ?{Modifier | 0 } ) ]] Damage if hit: ?{Attack type | Swing, [[ @{Swing} +1 ]] cut | Thrust, [[ @{Thrust} +1 ]] cr } /roll 3d6 I haven't tried to prettify that; it's just an illustration. If you build a bunch of Macros or Abilities that do this sort of thing, you can write a series of  Ability Command Buttons into another Ability that give you buttons for each of your attacks. For instance, an Ability called Attack (for a Character with Abilities called Broadsword, Brawling, and Knife): [Broadsword](~Broadsword) [Brawling](~Brawling) [Knife](~Knife) Then you can show the Attack Ability as a token button or in the macro bar. When you click that, a list of Ability Command Buttons appear in the text chat area. There are other ways to do what you're looking for; this is probably the simplest for the amount of detail you need for GURPS.
Thanks guys, I'll definitely have to research into those and see what I can make that will work best for my players. I really appreciate the input! I'll post here whatever I come up with. 
so I'm trying what is up there but it gives an odd error: TypeError: Cannot read property 'substring' of undefined This is the macro I made for my ritual path magic user: /em pulls energy from the surrounding area. Effective skill: [[ @{Path of Chance} + ( ?{Modifier | 0 } ) ]] /roll 3d6
Did you make this as a Macro or an Ability? It won't work as a Macro unless you specify a Token or Character it refers to, e.g. @{selected|Path of Chance} or @{John Smith|Path of Chance}. If it is an Ability, does the Character have an Attribute called Path of Chance?
ahh ok I see that now, but also for the macro an attribute has to be added in... I was hoping to get it to reference the character sheet so that it would update as the skill rises.
1490979610

Edited 1490979810
Character Sheet values will appear as Attributes as long as they are neither (a) automatically generated values nor (b) part of Repeating Lists. It's possible to reference  Repeating Lists in a Macro or Ability if you know either the position in the list it is or the line's RowID. You generally won't know either of these before the value is actually added to the Character Sheet. Values from the Character Sheet that do appear in the list of Attributes might not be named the same thing on the Sheet as they are in the Attributes. Any more sophisticated than that and you have to start programming the API.
ok so working on this, here's what I've come up with so far but the modifier is not actually working, it asks for it but it doesn't actually add or subtract to the skill, suggestions? &{template:default} {{name= Path of Chance}} {{check= [[3d6cs<6cf>2]]}} {{ESL= [[ @{Ignacio Mustang|Path_of_Chance}}+( ?{Modifier | 0 } ) ]]}}
ok so I'm trying to use the repeating lists that you pointed out to me (Thanks!) but for some reason when trying to use it, it errors out stating no attribute was found for it. maybe I'm confused on this, does this reference go into the macro, or does it get put into the attribute?  eg: /em pulls energy from the surrounding area. &{template:default} {{name= Path of Chance}} {{check= [[3d6cs<6cf>2]]}} {{ESL= [[ @{Ignacio Mustang|repeating_items_-K9jWU3JYFdBeUQfJA9Z}}+(?{Modifier | 0 }) ]]}}
1491000791
Lithl
Pro
Sheet Author
API Scripter
The Path_of_Chance attribute has an extra } at the end, which is likely throwing the dice engine off.
Your Repeating Items reference isn't correct. @{Ignacio Mustang|repeating_items_-K9jWU3JYFdBeUQfJA9Z_ valuenamehere } I don't know what the value names are on the GURPS sheet you're using, so substitute that in. The long random-character ID is just the ID of the row; you also have to specify which value in the row you want.
hmm I'm having trouble locating exactly what the value name is
Which character sheet are you using and where are you putting Path of Chance?
I'm using the sheet that just says GURPS I was hoping to have a way to copy the html that I'm seeing but my editor won't do that
Path of chance is a skill. the HTML shows sheet-col2 where the skill level is shown on the sheet.
On the GURPS sheet, the skill level in the skills repeating section is named attr_level .
unfortunately it still errors out on me when i place that in the valuenamehere portion of the syntax.
stating no attribute found
You've exhausted my ideas. You'll probably have to go pure API to get this done.
ahh ok, well I really appreciate all that you did, I learned alot thank you!