GenKitty said: *eardroop* Well, Aaron's idea of being able to replay dice rolls (with new modifiers) sounded good, in that other thread. I'm sure he will chime in here when he gets a chance. ^_^ Sorry! Was at a 48 hour Hackathon in Detroit... I've only had 9 hours sleep in that timeframe so hopefully my explanation will be intelligible! This actually works out great with HB's thought about the button for showing hidden sections. The basic idea is this: Start by processing the !power command as normal, except: Create a unique ID for this instance of executing Store all information about this instance in an object (doesn't have to be the state, but doing so would allow you to use it between restarts of the API instance or crashes). Embed that ID with special commands in your card as buttons When one of the buttons is clicked: Lookup the stored information via the ID passed to the command Make adjustments to the format Issue it with the changes. So an example. Say you issued something like: !power --title|Example --toHit|[[1d20+7]] > 15 --damage[toHit]|[[3d6+8]] (Assuming --toHit is parsed to determine success, and --damage[toHit] declares that parameter to be shown if toHit evaluates to success.) Internally, you might generate the ID of 7 to represent this instance of the !power command (the last was 6, the next is 8...). You could use this function: var getUniqueID = (function(){
var uIDSrc = 0;
return function(){
return uIDSrc++;
};
}()); Calling var id = getUniqueID() will return 0, 1, 2, 3, 4, ... for each call. Back to the example. You might parse the command and generate this structure in your code to represent it (you'd do it programmatically, but it would be conceptually like this): var commandData = {
id: 7,
parameters: [
{
idx: 0,
key: "title",
expression: "--title|Example"
},
{
idx: 1,
key: "toHit",
expression: "--toHit|$[[0]] > 15",
success: false,
rolls: {
0: { /* roll data for 1d20+7 */ }
}
},
{
idx: 2,
key: "damage[toHit]",
expression: "--damage[toHit]|$[[1]]",
hide: true,
rolls: {
1: { /* roll data for 3d6+8 */ }
}
}
]
}; Then you would store that in a part of your object that is keyed by that unique value: PowerCardsObj.CommandCache[id]=commandData; Assuming that a 6 was rolled for the 1d20, you would choose to hide the damage portion because 13 > 15 is false. However, you could embed a button with a command like this: !power-show 7 3 Which could then look back at that cache of command data and pull out the section to show: var sectionToShow = PowerCardsObj.CommandCache[arg1].parameters[arg2]; and then output just that row as a mini power card, or maybe reshow the whole thing, or whatever. Anyway, I hope that described the technique I was thinking about in sufficient detail... =D