Hey all, First of all, I have to admit that I have zero programming knowledge and I barely understand how API works. An API Scripter called Zetetic L. has created an API script for Double Cross TRPG. (Please refer to the attached source code, the scripter has agreed to share the source code to the community.) This game uses the d10 system. Out of all d10s rolled, the player will select the die with the highest number and that becomes the “achievement number” of that particular “skill-check”. Whenever the outcome of a particular die is greater than or equal to the critical value (By default: 10, the minimum critical value you can get is 2) is rolled out, a 10 will be automatically added to the “achievement number”. (Even If more than one die criticals during a roll, that count as one critical only. So 10 could be added to the “achievement number”) The player could then reroll all the "criticaled" dice again until it no longer Criticals. If the critical value happens to be 11, you can’t crit at all. (Since the maximum outcome you an get from a d10 is 10) You may refer to the following illustration from the English translation of the core rulebook: //To illustrate, lets say a player rolls three dice and gets a ten, ten, and a seven. The player has criticaled once and may re-roll two dice. The second roll comes up as a ten and three. The player has criticaled again and may re-roll one die. This next roll results in a five. Five is the player's Score and he gets a bonus of twenty for getting two Criticals. His resulting score is twenty-five.// The API works pretty well for calculating the “achievement number”. The only thing you’ll need to do is to type out what you’ll need in such format: !sr [Number of d10s]dx[critical value][+/-other adjustment] Say, you are going to roll 3d10s, the critical value is 2 and for some reason you also get a +2 adjustment. You'll input: “!sr 3dx2+2” in the chat room, then you will receive something like this: 3dx2+2 → 10[6, 8, 2] + 10[7, 7, 7] + 10[8, 5, 5] + 10[10, 6, 9] + 10[7, 3, 1] + 10[5, 1] + 10[6] + 10[9] + 10[5] + 10[3] + 1[1] +2 → 103 Looks cool right? But there’s something missing…...Yeah, it couldn't handle wrong inputs. For instance, if you try to input “!sr 3dx!” to the chatroom, the whole api sandbox would crash and you’ll have to restart it again. The API Output Console would say something like this: //Your scripts are currently disabled due to an error that was detected. Please make appropriate changes to your scripts and click the "Save Script" button and we'll attempt to start running them again. // As far as I know, this is called the “error lock” and I am incapable of solving it (not unless I restart the sandbox everytime someone screwed up). I would greatly appreciate it if someone could help me out... ----------------------Source code--------------------------------- <a href="https://gist.github.com/MeowLKW/28b3f372740b73c56c666e82ba7a7bdc" rel="nofollow">https://gist.github.com/MeowLKW/28b3f372740b73c56c666e82ba7a7bdc</a>