///////////////////////////// /// stdArguments.zh - v6.1 // ///////////////////////////// /// EXPLANATION ///////////// //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // stdArguments.zh allows you to use portions of a value that you enter into the ZQ script argument values fields // // and save any unused portion of that value to use for other assigns. That is, if you enter a D0 value of 12345.6789 // // normally that is the exact value passed to whatever assign you use for D0. Often, you either do not need a value that // // has a floating point (decimal places), or you do not need all nine digits available, or in some cases, you need a value // // in excess of 32,768.0000, which is the largest value you can normally enter into these fields (due to how ZC converts // // floats into ints. // // What this header does is to allow you to specify the exact digits of an argument that you are using for that assign // // such as using the lowest five digits of the value 12345.6789 (5.6789) and turn that into an integer of 56,789. You can // // use a minimum of a single digit out of any argument, to all nine digits, all as integer values. A good example is using // // the value 12345.6789 to pass as THREE VALUES of 123, 456, and 789. That means that you do not need to hard-code values // // in your scripts, and that you have a very wide range of possible uses. // // You can set up a single argument to use four digits for one value, two for another and a three digit value for arguments. // // A value of 12345.6789 could become four values of (1234), (56), and (789). Alternatively, you could have four two-digit values // // and a single one-digit value, such as converting 12345.6789 into the following values (1), (23), (45), (67), and (89). // // The header contains commands for using each of the nine digits as single values, two methods for using two-digit values // // using the thousands place as the highest portion of a value (e.g. 12345.6789 uses (23) or using the ten-thousands place of a // // value (e.g. 12345.6789 becomes (12). You can combine any of these commands as long as your total value does not exceed nine-digits // // or, if you are very clever, anbd your values overlap, technically squeeze even more out of it. // // For example, if you need the following values (1), (12), (250), (5026), (2250), (265), and (50), (503), (25), and (3) you can enter // // the value 12501.6503, and use the commands to extract the vital areas. This is only useful if you are certain of the values ahead // // of time, but is in theory, possible. The value 12501.6503 would be processed in the following ways, with the sections in parentheses // // as individual values: (1)2502.6503, (12)502.6503, 1(250)2.6503, 12(502.6)503, 1250(2.65)03, 12502.6(50)3, 12502.6(503) and 12502.650(3). // // While this has academic possibilities, in reality you will want to be able to have entirely flexible assigns, to enter any values as // // you need for more generic scripts. You can set up these values in advance, to make sets of values such as (xxx)(xxx)(xxx) for three values // // of three-digits, or as (xx)(xx)(xx)(xxx) fr three values of two-digits, plus one value of three-digits, or as (x)(xx)(xx)(xx)(xx) for // // four two-digit values and a single one-digit value. // // It is important to keep in mind that the largest value that you cna pass in the editor is 32,768.0000, which means that whatever // // value you assign to the highest position (using the ten-thousands-place) should retain a capped range of 0-2, ensuring that all of your // // other value sets have a maximum of (9), (99), (999), (9,999), (99,999), (999,999), (9,999,999), and (99,999,999). // // Therefore, it is wise to plan ahead. If any value needs a range of 000-299, 00-29, or 0-2, then you should assign it to the highest // // decimal places, using the ten-thousands digits. If you are very careful, you can ensure that you can have a tens-thousands value range of 0-3, // // however this caps your thousands/hundreds/tens value at (275), assuming you want to maximise your decimal places, as a value of 32,759.9999 // // can be rendered. // // Prudence of keeping any value using the ten-thoudands place at a maximum of '2' ensures that all of your other values max out. You can // // tinker with the numbers as you see fit, as long as you keep this limitation in mind. // //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// int GetRemainderAsInt(int v) { int r = (v - (v << 0)) * 10000; return r; } // This function breaks up the value of an argument into individual digits. It is combined with the function GetDigit below. int GetDigit(int n, int place) { place = Clamp(place, -4, 4); if(place < 0) { n = GetRemainderAsInt(n); place += 4; } int r = ((n / Pow(10, place)) % 10) << 0; return r; } int GetPartialArg(int arg, int place, int num){ place = Clamp(place, -4, 4); int r; int adj = 1; for(int i = num-1; i > -1; i--){ if(place - i < -4) continue; r += GetDigit(arg, place - i) * adj; adj *= 10; } return r; } // This extracts values from an argument by selecting the highest place value and the number of gdigits below that to extract; arg is the original argument, place is the highest place (between 4 and -4), num is the number of digits // ex: 765 from 00765.0000 would be place = 2 and num = 3 and 2345 from 00002.3450 would be place = 0 and num = 4 // This function breaks up each digit of an argument value into a single, usable value. // This means that you can use nine values from one argument... // As an example, if you have D0 set to 12345.6789, you can break up each digit of this argument value // and individually set the values for '1', '2', '3', '4', '5', '6', '7', '8', and '9' as values in an assign. // An example of using this is below. // To create the assigns, you must first set the D# value that you wish to use to an assign (e.g. 'switches') // and then set assigns for each of the GetDigit values. // // //item script GetDigitScript{ // void run(switches){ // int switch0 = GetDigit(switches, 4); // int switch1 = GetDigit(switches, 3); // int switch2 = GetDigit(switches, 2); // int switch3 = GetDigit(switches, 1); // int switch4 = GetDigit(switches, 0); // int switch5 = GetDigit(switches, -1); // int switch6 = GetDigit(switches, -2); // int switch7 = GetDigit(switches, -3); // int switch8 = GetDigit(switches, -4); // // Switch: Decimal Place: Value Range: // 0 #xxxx.xxxx (Ten-Thousands) 0-to-2 // 1 x#xxx.xxxx (Thousands) 0-to-9 // 2 xx#xx.xxxx (Hundreds) 0-to-9 // 3 xxx#x.xxxx (Tens) 0-to-9 // 4 xxxx#.xxxx (Ones) 0-to-9 // 5 xxxxx.#xxx (Tenths) 0-to-9 // 6 xxxxx.x#xx (Hundredths) 0-to-9 // 7 xxxxx.xx#x (Thousandths) 0-to-9 // 8 xxxxx.xxx# (Ten-Thousandths) 0-to-9 // // Using this, your D0 argument now has nine places, eight of which can have a value that you can place at 0 through 9, // and one with a value of 0-2. using these as individual assigns switch0 through switch8, as if each was its own *individual argument*. // // Now, you can combine both of these special functions in one script, which allows you to use regular argument assigns // or split (high and low) assigns, or digit-based assigns as you require. You can make each D# argument in your // script use any of these types of assigns: // /////////////////////////// // Get Nine-Digit Values // /////////////////////////// int GetValueAsInt(int arg) {return arg - (arg >> 0) * 10000;} // Use this to utilise all nine places as an integer; thus, the value 12345.6789 becomes the value 123,456,789. // This is EXTREMELY Useful if you want to reference a combo, or pther large value, as otherwise the maximum combo value is 32,768 which // is far less than even the classic tileset combo numbering, as this would cap ypur combo nnumber to Page-126, row-1, tile-9. // COmverting the whole value to an integer extends, and thus using this function permits combo entry to a value of 327,680,000 // which exceeds the maximum combo value 65,519, the last combo of Page-251. // PLACE (#####.####) //////////////////////////// // Get Eight-Digit Values // //////////////////////////// int Get8High(int arg) {return arg - (arg >> 0) + ( GetDigit(arg, -4) + (GetDigit(arg, -3) * 10) + (GetDigit(arg, -2) * 100 ) + (GetDigit(arg, -1) * 1000 ) + (GetDigit(arg, 0) * 10000 ) + (GetDigit(arg, 1) * 100000 ) + (GetDigit(arg, 2) * 1000000 ) + (GetDigit(arg, 3) * 10000000 ) );} //This gets the 8 HIGHEST decimal places and turns it into an individual value. Thus, 12345.6789 becomes a value of (12345678). Use this if you do not need a value in excess of 32767999. // PLACE (#####.###x) int Get8Low(int arg) ( GetDigit(arg, -3) + (GetDigit(arg, -2) * 10) + (GetDigit(arg, -1) * 100 ) + (GetDigit(arg, 0) * 1000 ) + (GetDigit(arg, 1) * 10000 ) + (GetDigit(arg, 2) * 100000 ) + (GetDigit(arg, 3) * 1000000 ) + (GetDigit(arg, 4) * 10000000 ) );} //This gets the 8 LOWEST decimal places and turns it into an individual value. Thus, 12345.6789 becomes a value of (123456). Use this if you need a value in excess of 32767999; max 99,999,999. // PLACE (x####.####) //////////////////////////// // Get Seven-Digit Values // //////////////////////////// int Get7High(int arg) {return arg - (arg >> 0) + ( GetDigit(arg, -2) + (GetDigit(arg, -1) * 10) + (GetDigit(arg, 0) * 100 ) + (GetDigit(arg, 1) * 1000 ) + (GetDigit(arg, 2) * 10000 ) + (GetDigit(arg, 3) * 100000 ) + (GetDigit(arg, 4) * 1000000 ) );} //This gets the 7 HIGHEST (ten-thousands, thousands, hundreds, ones, tenths, hundredths) decimal places and turns it into an individual value. Thus, 12345.6789 becomes a value of (1234567). Use this if you do not need a value in excess of 3276799. // PLACE (#####.##xx) int Get7Mid(int arg) {return arg - (arg >> 0) + ( GetDigit(arg, -3) + (GetDigit(arg, -2) * 10) + (GetDigit(arg, -1) * 100 ) + (GetDigit(arg, 0) * 1000 ) + (GetDigit(arg, 1) * 10000 ) + (GetDigit(arg, 2) * 100000 ) + (GetDigit(arg, 3) * 1000000 ) );} //This gets the 7 MIDDLE (thousands, hundreds, ones, tenths, hundredths, thousandths) decimal places and turns it into an individual value. Thus, 12345.6789 becomes a value of (1234567). Use this if you do not need a value in excess of 3276799. // PLACE (x####.###x) int Get7Low(int arg) {return arg - (arg >> 0) + ( GetDigit(arg, -4) + (GetDigit(arg, -3) * 10) + (GetDigit(arg, -2) * 100 ) + (GetDigit(arg, -1) * 1000 ) + (GetDigit(arg, 0) * 10000 ) + (GetDigit(arg, 1) * 100000 ) + (GetDigit(arg, 2) * 1000000 ) );} //This gets the 7 LOWEST (thousands, hundreds, ones, tenths, hundredths, ten-thousandths) decimal places and turns it into an individual value. Thus, 12345.6789 becomes a value of (123456). Use this if you need a value in excess of 3276799; max 9,999,999. // PLACE (xx###.####) ////////////////////////// // Get Six-Digit Values // ////////////////////////// int GetValue6High(int arg) {return arg - (arg >> 0) + ( GetDigit(arg, -1) + (GetDigit(arg, 0) * 10) + (GetDigit(arg, 1) * 100 ) + (GetDigit(arg, 2) * 1000 ) + (GetDigit(arg, 3) * 10000 ) + (GetDigit(arg, 4) * 100000 ) );} //This gets the 6 HIGHEST (ten-thousands, thousands, hundreds, tens, ones, tenths) decimal places and turns it into an individual value. Thus, 12345.6789 becomes a value of (123456). Use this if you do not need a value in excess of 327679. // PLACE (#####.#xxx) int GetValue6Mid234567(int arg) {return arg - (arg >> 0) + ( GetDigit(arg, -2) + (GetDigit(arg, -1) * 10) + (GetDigit(arg, 0) * 100 ) + (GetDigit(arg, 1) * 1000 ) + (GetDigit(arg, 2) * 10000 ) + (GetDigit(arg, 3) * 100000 ) );} //This gets the 6 MIDDLE (thousands, hundreds, tens, ones, tenths, hundredths) decimal places and turns it into an individual value. Thus, 12345.6789 becomes a value of (123456). Use this if you do not need a value in excess of 327679. // PLACE (x####.##xx) int GetValue6Mid345678(int arg) {return arg - (arg >> 0) + ( GetDigit(arg, -3) + (GetDigit(arg, -2) * 10) + (GetDigit(arg, -1) * 100 ) + (GetDigit(arg, 0) * 1000 ) + (GetDigit(arg, 1) * 10000 ) + (GetDigit(arg, 2) * 100000 ) );} //This gets the 6 MIDDLE (hundreds, tens, ones, tenths, hundredths, thousandths) decimal places and turns it into an individual value. Thus, 12345.6789 becomes a value of (123456). Use this if you do not need a value in excess of 327679. // PLACE (xx###.###x) int GetValue6Low(int arg) {return arg - (arg >> 0) + ( GetDigit(arg, -4) + (GetDigit(arg, -3) * 10) + (GetDigit(arg, -2) * 100 ) + (GetDigit(arg, -1) * 1000 ) + (GetDigit(arg, 0) * 10000 ) + (GetDigit(arg, 0) * 100000 ) );} //This gets the 6 LOWEST (tens, ones, tenths, hundredths, thousandths, ten-thousandths) decimal places and turns it into an individual value. Thus, 12345.6789 becomes a value of (456789). Use this if you need a value in excess of 327679; max 999,999. // PLACE (xxx##.####) /////////////////////////// // Get Five-Digit Values // /////////////////////////// int GetValue5High(int arg) {return arg >> 0;} //This gets the 5 HIGHEST decimal places (ten-thousands, thousands, hundreds, tens, ones) and turns it into an individual value. Thus, 12345.6789 becomes a value of (12345). Use this if you do not need a value in excess of 32767. // PLACE (#####.xxxx) int GetValue5Mid23456(int arg) {return arg - (arg >> 0) + ( GetDigit(arg, -1) + (GetDigit(arg, 0) * 10) + (GetDigit(arg, 1) * 100 ) + (GetDigit(arg, 2) * 1000 ) + (GetDigit(arg, 3) * 10000 ) );} //This gets the 5 MIDDLE (thousands, hundreds, tens, ones, tenths) decimal places and turns it into an individual value. // PLACE (x####.#xxx) int GetValue5Mid34567(int arg) {return arg - (arg >> 0) + ( GetDigit(arg, -2) + (GetDigit(arg, -1) * 10) + (GetDigit(arg, 0) * 100 ) + (GetDigit(arg, 1) * 1000 ) + (GetDigit(arg, 2) * 10000 ) );} //This gets the 5 MIDDLE (hundreds, tens, ones, tenths, hundredths) decimal places and turns it into an individual value. // PLACE (xx###.##xx) int GetValue5Mid45678(int arg) {return arg - (arg >> 0) + ( GetDigit(arg, -3) + (GetDigit(arg, -2) * 10) + (GetDigit(arg, -1) * 100 ) + (GetDigit(arg, 0) * 1000 ) + (GetDigit(arg, 1) * 10000 ) );} //This gets the 5 MIDDLE (tens, ones, tenths, hundredths, thousandths) decimal places and turns it into an individual value. // PLACE (xxx##.###x) int GetValue5Low(int arg) {return arg - (arg >> 0) + ( GetDigit(arg, -4) + (GetDigit(arg, -3) * 10) + (GetDigit(arg, -2) * 100 ) + (GetDigit(arg, -1) * 1000 ) + (GetDigit(arg, 0) * 10000 ) );} //This gets the 5 LOWEST decimal places (ones, tenths, hundredths, thousandths, ten-thousandths) and turns it into an individual value. Thus, 12345.6789 becomes a value of (56789). Use this if you do need a value in excess of 32767; max 99,999. // PLACE (xxxx#.####) /////////////////////////// // Get Four-Digit Values // /////////////////////////// int GetValue4High(int arg) {return arg - (arg >> 0) + ( GetDigit(arg, 1) + (GetDigit(arg, 2) * 10) + (GetDigit(arg, 3) * 100) + (GetDigit(arg, 4) * 1000) );} //This gets the 4 HIGHEST decimal places and turns it into an individual value. Thus, 12345.6789 becomes a value of (1234). Use this if you do not need a value in excess of 3275. // PLACE (####x.xxxx) int GetValue4Mid6789(int arg) {return arg - (arg >> 0) + ( GetDigit(arg, 0) + (GetDigit(arg, 1) * 10) + (GetDigit(arg, 2) * 100) + (GetDigit(arg, 3) * 1000) );} // PLACE (x####.xxxx) int GetValue4Mid4567(int arg) {return arg - (arg >> 0) + ( GetDigit(arg, -1) + (GetDigit(arg, 0) * 10) + (GetDigit(arg, 1) * 100) + (GetDigit(arg, 2) * 1000) );} // PLACE (xx###.#xxx) int GetValue4Mid3456(int arg) {return arg - (arg >> 0) + ( GetDigit(arg, -2) + (GetDigit(arg, 1) * 10) + (GetDigit(arg, 2) * 100) + (GetDigit(arg, 3) * 1000) );} // PLACE (xxx##.##xx) int GetValue4Mid2345(int arg) {return arg - (arg >> 0) + ( GetDigit(arg, -3) + (GetDigit(arg, -2) * 10) + (GetDigit(arg, -1) * 100) + (GetDigit(arg, 0) * 1000) );} // PLACE (xxxx#.###x) int GetValue4Low(int arg) {return (arg - (arg >> 0)) * 10000;} //This gets the 4 LOWEST decimal places and turns it into an individual value. Thus, 12345.6789 becomes a value of (6789). Use this if you need a value in excess of 3275; max 9,999. // PLACE (xxxxx.####) //////////////////////////// // Get Three-Digit Values // //////////////////////////// int GetValue3High(int arg) {return arg - (arg >> 0) + ( GetDigit(arg, 2) + (GetDigit(arg, 3) * 10) + (GetDigit(arg, 4) * 100 ) );} //This gets the 3 HIGHEST decimal places and turns it into an individual value. Thus, 12345.6789 becomes a value of (123). Use this if you need a value in excess of 326. // PLACE (###xx.xxxx) int GetValue3Upper234(int arg){return arg - (arg >> 0) + ( GetDigit(arg, 1) + (GetDigit(arg, 2) * 10) + (GetDigit(arg, 3) * 100 ) );} //This gets 3 MIDDLE decimal (thousands, hundreds, tens) places and turns it into an individual value. Thus, 12345.6789 becomes a value of (456); max 999. // PLACE (x###x.xxxx) int GetValue3Upper345(int arg){return arg - (arg >> 0) + ( GetDigit(arg, 0) + (GetDigit(arg, 1) * 10) + (GetDigit(arg, 2) * 100 ) );} //This gets 3 MIDDLE decimal (thousands, hundreds, tens) places and turns it into an individual value. Thus, 12345.6789 becomes a value of (456); max 999. // PLACE (xx###.xxxx) int GetValue3Mid(int arg) {return arg - (arg >> 0) + ( GetDigit(arg, -1) + (GetDigit(arg, 0) * 10) + (GetDigit(arg, 1) * 100 ) );} //This gets the 3 MIDDLE decimal places and turns it into an individual value. Thus, 12345.6789 becomes a value of (456); max 999. // PLACE (xxx##.#xxx) int GetValue3Lower567(int arg){return arg - (arg >> 0) + ( GetDigit(arg, -2) + (GetDigit(arg, -1) * 10) + (GetDigit(arg, 0) * 100 ) );} //This gets 3 MIDDLE decimal (tens, tenths, hundredths) places and turns it into an individual value. Thus, 12345.6789 becomes a value of (456); max 999. // PLACE (xxxx#.##xx) int GetValue3Lower678(int arg){return arg - (arg >> 0) + ( GetDigit(arg, -3) + (GetDigit(arg, -2) * 10) + (GetDigit(arg, -1) * 100 ) );} //This gets 3 MIDDLE decimal (tenths, hundredths, thousandths) places and turns it into an individual value. Thus, 12345.6789 becomes a value of (456); max 999. // PLACE (xxxxx.###x) int GetValue3Low(int arg) {return arg - (arg >> 0) + ( GetDigit(arg, -4) + (GetDigit(arg, -3) * 10) + (GetDigit(arg, -2) * 100 ) );} //This gets the 3 LOWEST decimal places and turns it into an individual value. Thus, 12345.6789 becomes a value of (789); max 999. // PLACE (xxxxx.x###) ////////////////////////// // Get Two-Digit Values // ////////////////////////// /////////////////////////////////////////////////////////////////////////// // The following GetValue commands *DO NOT* use the ten-thousands place. // /////////////////////////////////////////////////////////////////////////// int GetValue278(int arg) {return arg - (arg >> 0) + ( GetDigit(arg, 3) + (GetDigit(arg, 4) * 10) );} //This gets the decimal places (thousands, hundreds) and turns it into an individual value. Thus, 12345.6789 becomes a value of (23). // PLACE (x##xx.xxxx) int GetValue265(int arg) {return arg - (arg >> 0) + ( GetDigit(arg, 1) + (GetDigit(arg, 2) * 10) );} //This gets the decimal places (tens, ones) and turns it into an individual value. Thus, 12345.6789 becomes a value of (45). // PLACE (xxx##.xxxx) int GetValue243(int arg) {return arg - (arg >> 0) + ( GetDigit(arg, -1) + (GetDigit(arg, 0) * 10) );} //This gets the decimal places (tenths, hundredths) and turns it into an individual value. Thus, 12345.6789 becomes a value of (67). // PLACE (xxxxx.##xx) int GetValue221(int arg) {return arg - (arg >> 0) + ( GetDigit(arg, -2) + (GetDigit(arg, -1) * 10) );} //This gets the decimal places (thousandths, ten-thousandths) and turns it into an individual value. Thus, 12345.6789 becomes a value of (89). // PLACE (xxxx.xx##) /////////////////////////////////////////////////////////////////////// // The following GetValue commands *DO* use the ten-thousands place. // /////////////////////////////////////////////////////////////////////// int GetValue298(int arg) {return arg - (arg >> 0) + ( GetDigit(arg, 3) + (GetDigit(arg, 4) * 10) );} //This gets the decimal places (ten-thousands, thousands) and turns it into an individual value. Thus, 12345.6789 becomes a value of (12). // PLACE (##xxx.xxxx) int GetValue276(int arg) {return arg - (arg >> 0) + ( GetDigit(arg, 1) + (GetDigit(arg, 2) * 10) );} //This gets the decimal places (hundreds, tens) and turns it into an individual value. Thus, 12345.6789 becomes a value of (34). // PLACE (xx##x.xxxx) int GetValue254(int arg) {return arg - (arg >> 0) + ( GetDigit(arg, -1) + (GetDigit(arg, 0) * 10) );} //This gets the decimal places (tenths, hundredths) and turns it into an individual value. Thus, 12345.6789 becomes a value of (56). // PLACE (xxxx#.#xxx) int GetValue232(int arg) {return arg - (arg >> 0) + ( GetDigit(arg, -3) + (GetDigit(arg, -2) * 10) );} //This gets the decimal places (thousandths, ten-thousandths) and turns it into an individual value. Thus, 12345.6789 becomes a value of (78). // PLACE (xxxxx.xx##) ////////////////////////// // Get One-Digit Values // ////////////////////////// int GetValue19(int arg) {return arg - (arg >> 0) + (GetDigit(arg, 4)) );} //This gets the single valuee of the ten-thousands decimal place and turns it into an individual value. Thus, 12345.6789 becomes a value of (1). // PLACE (#xxxx.xxxx) int GetValue1Highest(int arg) {return arg - (arg >> 0) + (GetDigit(arg, 4)) );} //This gets the single valuee of the ten-thousands (#xxxx.xxxx) decimal place and turns it into an individual value. Thus, 12345.6789 becomes a value of (1). // PLACE (#xxxx.xxxx) int GetValue18(int arg) {return arg - (arg >> 0) + (GetDigit(arg, 3)) );} //This gets the single valuee of the thousands (x#xxx.xxxx) decimal place and turns it into an individual value. Thus, 12345.6789 becomes a value of (2). // PLACE (x#xxx.xxxx) int GetValue17(int arg) {return arg - (arg >> 0) + (GetDigit(arg, 2)) );} //This gets the single valuee of the hundreds (xx#xx.xxxx) decimal place and turns it into an individual value. Thus, 12345.6789 becomes a value of (3). // PLACE (xx#xx.xxxx) int GetValue16(int arg) {return arg - (arg >> 0) + (GetDigit(arg, 1)) );} //This gets the single valuee of the tens (xxx#x.xxxx) decimal place and turns it into an individual value. Thus, 12345.6789 becomes a value of (4). // PLACE (xxx#x.xxxx) int GetValue15(int arg) {return arg - (arg >> 0) + (GetDigit(arg, 0)) );} //This gets the single valuee of the ones (xxxx#.xxxx) decimal place and turns it into an individual value. Thus, 12345.6789 becomes a value of (5). // PLACE (xxxx#.xxxx) int GetValue14(int arg) {return arg - (arg >> 0) + (GetDigit(arg, -1)) );} //This gets the single valuee of the tenths (xxxxx.x#xx) decimal place and turns it into an individual value. Thus, 12345.6789 becomes a value of (6). // PLACE (xxxxx.#xxx) int GetValue13(int arg) {return arg - (arg >> 0) + (GetDigit(arg, -2)) );} //This gets the single valuee of the hundredths (xxxxx.x#xx) decimal place and turns it into an individual value. Thus, 12345.6789 becomes a value of (7). // PLACE (xxxxx.x#xx) int GetValue12(int arg) {return arg - (arg >> 0) + (GetDigit(arg, -3)) );} //This gets the single valuee of the thousandths (xxxxx.xx#x) decimal place and turns it into an individual value. Thus, 12345.6789 becomes a value of (8). // PLACE (xxxxx.xx#x) int GetValue11(int arg) {return arg - (arg >> 0) + (GetDigit(arg, -4)) );} //This gets the single valuee of the ten-thousandths (xxxxx.xxx#) decimal place and turns it into an individual value. Thus, 12345.6789 becomes a value of (9). // PLACE (xxxxx.xxx#) int GetValue1Lowest(int arg) {return arg - (arg >> 0) + (GetDigit(arg, -4)) );} //This gets the single valuee of the ten-thousandths decimal place and turns it into an individual value. Thus, 12345.6789 becomes a value of (9). // PLACE (xxxxx.xxx#) ///////////////////// // LEGACY COMMANDS // ///////////////////// ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // These functions are essentially outmoded by the commands above, but are included for legacy support to anyone // // that has elected to use this header up to this point. You may wish to check your scripts to ensure that all the // // functions of your scripts still work, and update any that do not, as I have also corrected a couple bugs in the // // old functions that kept them from working exactly as intended. // ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// int GetHighArgument(int arg) {return arg >> 0;} int GetLowArgument(int arg) {return (arg - (arg >> 0)) * 10000;} int GetFiveAndFourBig(int arg) {return arg - (arg >> 0) + ( GetDigit(arg, 0) + (GetDigit(arg, 1) * 10) + (GetDigit(arg, 2) * 100 ) + (GetDigit(arg, 3) * 1000 ) + (GetDigit(arg, 4) * 10000 ) );} int GetFiveAndFourSmall(int arg) {return arg - (arg >> 0) + ( GetDigit(arg, -4) + (GetDigit(arg, -3) * 10) + (GetDigit(arg, -2) * 100) + (GetDigit(arg, -1) * 1000) );} // Similarly, you can use this function to use the lowest five digits of an argument as an integer, while reserving the higest gour digits (ones, hundreds thousands and ten-thousands // as a secondary argument. The maximum value of the five-digit argument // (1) is 99,999, with a maximum value of the four-digit argment is 3199 or; // (2) a maximum five-digit argument of 80,000 and a four-digit maximum value of 80,000 and a dour-digit value up to 3,276. // An exaple value is 30149.6829, which is broken into tw srguments (3014) and (9829). // This is similar to GetHighArgument and GetLowArgument, except that the maximum value of the give-digit // argument is now 99,999 instead of 31999. int GetLowTriArgument(int arg) {return arg - (arg >> 0) + ( GetDigit(arg, -4) + (GetDigit(arg, -3) * 10) + (GetDigit(arg, -2) * 100 ) );} int GetMidTriArgument(int arg) {return arg - (arg >> 0) + ( GetDigit(arg, -1) + (GetDigit(arg, 0) * 10) + (GetDigit(arg, 1) * 100 ) );} int GetHighTriArgument(int arg) {return arg - (arg >> 0) + ( GetDigit(arg, 2) + (GetDigit(arg, 3) * 10) + (GetDigit(arg, 4) * 100 ) );} // These functions allow you to use the integer and decimal portions of an argument as two separate arguments. // For example, if you have D0 as 0010.0023, you can split it into two arguments with the values '10' and '23' respectively. // An example of using this is appended below: int GetFiveAndThreeBig(int arg) {return arg - (arg >> 0) + ( GetDigit(arg, -1) + (GetDigit(arg, 0) * 10) + (GetDigit(arg, 1) * 100 ) + (GetDigit(arg, 2) * 1000 ) + (GetDigit(arg, 3) * 10000 ) );} int GetFiveAndThreeSmall(int arg) {return arg - (arg >> 0) + ( GetDigit(arg, -4) + (GetDigit(arg, -3) * 10) + (GetDigit(arg, -2) * 100) );} // This works as getFiveAndFourBig & GetFiveAndFourSmall, except that it uses all three values of the small argument (ten-thousands, thousands, and hundreds // changing the range to a five-digit argument of 99,999, a three-digit of either 999 (with the ten-thousands place reserved for getDigit with a value of 0-2 // or 80,000 for the five-digit segment, 276 for the three-digit value, with the ten-thousands digit ranging from 0-3. // For example, the value 31,999.9999 becomes the values (GetFiveAndDThreeBig) of 99,999 and the value of GetFiveAndDThreeSmall // capped at 999 (if you want to use the ten-thousands place with a range of 0-2, or a value of GetFiveAndDThreeSmall from 000-768, and // the tens-thousands place with a range of 0-3. int GetFiveAndDuoTwoFive(int arg) {return arg - (arg >> 0) + ( GetDigit(arg, -4) + (GetDigit(arg, -3) * 10) + (GetDigit(arg, -2) * 100 ) + (GetDigit(arg, -1) * 1000 ) + (GetDigit(arg, 0) * 10000 ) );} int GetFiveAndDuoTwoTwoLow(int arg) {return arg - (arg >> 0) + ( GetDigit(arg, 1) + (GetDigit(arg, 2) * 10) );} int GetFiveAndDuoTwoTwoHigh(int arg) {return arg - (arg >> 0) + ( GetDigit(arg, 3) + (GetDigit(arg, 4) * 10) );} // This splits the value into a give-digit big value, and two dual-digit small values. // The five-digit value remains 99,999, but the two dual-digit arguments can be set to either // (1) GetFiveAndDuoTwoLow as a maximum of 99 and GetFiveAndDuoTwoHigh with a maximum of 31 or; // (2) The five-digit argument capped at 80,000, GetFiveAndDuoTwoLow at a maximum of 76 and GetFiveAndDuoTwoHigh with // a maximum of 32. int GetSixAndTwoBig(int arg) {return arg - (arg >> 0) + ( GetDigit(arg, -4) + (GetDigit(arg, -3) * 10) + (GetDigit(arg, -2) * 100 ) + (GetDigit(arg, -1) * 1000 ) + (GetDigit(arg, 0) * 10000 ) + (GetDigit(arg, 1) * 100000 ) );} int GetSixAndTwoSmall(int arg) {return arg - (arg >> 0) + ( GetDigit(arg, 2) + (GetDigit(arg, 3) * 10) );} // This splits the argument into a six-digit value, and a two-digit value, leaving the ten-thousands place reserved // for GetDigit. Them aximum values are: GetSixAndTwoBig at 999,999, GetSixAndTwoSmall at 99 and the ten-thousands place // for GetDigit with a range of 0-2. // Else, GetSixAndTwoBig at 680,000, GetSixAndTwoSmall at 27 and the tens-thousands place for GetDigit with a range of 0-3. int GetSixAndThreeBig(int arg) {return arg - (arg >> 0) + ( GetDigit(arg, -4) + (GetDigit(arg, -3) * 10) + (GetDigit(arg, -2) * 100 ) + (GetDigit(arg, -1) * 1000 ) + (GetDigit(arg, 0) * 10000 ) + (GetDigit(arg, 1) * 100000 ) );} int GetSixAndThreeSmall(int arg) {return arg - (arg >> 0) + ( GetDigit(arg, 2) + (GetDigit(arg, 3) * 10) + (GetDigit(arg, 4) * 100) );} // This splits the argument into a six-digit value, and a three-digit value... // Them aximum values are: GetSixAndTwoBig at 999,999, GetSixAndTwoSmall at 326 or; // Else, GetSixAndThreeSmall at 680,000, GetSixAndThreeBig at 327. int GetSevenAndOneBig(int arg) {return arg - (arg >> 0) + ( GetDigit(arg, -4) + (GetDigit(arg, -3) * 10) + (GetDigit(arg, -2) * 100 ) + (GetDigit(arg, -1) * 1000 ) + (GetDigit(arg, 0) * 10000 ) + (GetDigit(arg, 1) * 100000 ) + (GetDigit(arg, 2) * 1000000 ) );} int GetSevenAndOneSmall(int arg) {return arg - (arg >> 0) + ( GetDigit(arg, 3) );} // This splits the argument into one seven-digit value, and a one-digit value, leaving the ten-thousands place reserved // for GetDigit. Them maximum values are: GetSevenAndOneBig at 9,999,999, GetSevenAndOneSmall at 9 and the ten-thousands place // for GetDigit with a range of 0-2. // Else, GetSixAndTwoBig at 7,680,000, GetSixAndTwoSmall at 0-2 and the tens-thousands place for GetDigit with a range of 0-3. int GetSevenAndTwoBig(int arg) {return arg - (arg >> 0) + ( GetDigit(arg, -4) + (GetDigit(arg, -3) * 10) + (GetDigit(arg, -2) * 100 ) + (GetDigit(arg, -1) * 1000 ) + (GetDigit(arg, 0) * 10000 ) + (GetDigit(arg, 1) * 100000 ) + (GetDigit(arg, 2) * 1000000 ) );} int GetSevenAndTwoHigh(int arg) {return arg - (arg >> 0) + ( GetDigit(arg, 3) + (GetDigit(arg, 4) * 10) );} // This splits the argument into one seven-digit value, and a two-digit value. // Them maximum values are: GetSevenAndTwoBig at 9,999,999, GetSevenAndTwoSmall at 36. // Else, GetSevenAndTwoBig at 7,680,000, and GetSevenAndTwoSmall at 0-32. // //item script HighLow{ // void run (int High0_Low0, int High1_Low1, int High2_Low2, int High3_Low3, int High4_Low4, int High5_Low5, int High6_Low6, int High7_Low7) { // int Argument0H = GetHighArgument(High0_Low0); // int Argument0L = GetLowArgument(High0_Low0); // int Argument1H = GetHighArgument(High1_Low1); // int Argument1L = GetLowArgument(High1_Low1); // int Argument2H = GetHighArgument(High2_Low2); // int Argument2L = GetLowArgument(High2_Low2); // int Argument3H = GetHighArgument(High3_Low3); // int Argument3L = GetLowArgument(High3_Low3); // int Argument4H = GetHighArgument(High4_Low4); // int Argument4L = GetLowArgument(High4_Low4); // int Argument5H = GetHighArgument(High5_Low5); // int Argument5L = GetLowArgument(High5_Low5); // int Argument6H = GetHighArgument(High6_Low6); // int Argument6L = GetLowArgument(High6_Low6); // int Argument7H = GetHighArgument(High7_Low7); // int Argument7L = GetLowArgument(High7_Low7); // } // } // // Obviously, you will want to name assigns in a way that allows you to remember what they do! // Merely change both the original assign for the D# argument in your void run() command to something you can rememeber... // Then name the assigns (or sub-assigns) for the high and low halves to something that makes sense for your script. // For example: // //item script SpecialItem{ // void run (int hearts_magic, int colour_duration, int power_speed, int FFCSlot_SpecialCounter, int LType_nouse, int SFX_Weapon_SFX_ERROR, int ItemNumber_SWSprite, int other1_other2) { // int hearts = GetHighArgument(hearts_magic); // int magic = GetLowArgument(hearts_magic); // int colour = GetHighArgument(colour_duration); // int duration = GetLowArgument(colour_duration); // int power = GetHighArgument(power_speed); // int speed = GetLowArgument(power_speed); // int FFCSlot = GetHighArgument(FFCSlot_SpecialCounter); // int itemCounter = GetLowArgument(FFCSlot_SpecialCounter); // int LType = GetHighArgument(LType_nouse); // int nouse = GetLowArgument(LType_nouse); // int SFX_Weapon = GetHighArgument(SFX_Weapon_SFX_ERROR); // int ERROR_SFX = GetLowArgument(SFX_Weapon_SFX_ERROR); // int ItemNumber = GetHighArgument(ItemNumber_SWSprite); // int SWSprite = GetLowArgument(ItemNumber_SWSprite); // int Other1 = GetHighArgument(Other1_Other2); // int Other2 = GetLowArgument(Other1_Other2); // } // } // int GetFirstDuoArgument(int arg) {return arg - (arg >> 0) + ( GetDigit(arg, 2) + (GetDigit(arg, 3) * 10) );} int GetSecondDuoArgument(int arg) {return arg - (arg >> 0) + ( GetDigit(arg, 0) + (GetDigit(arg, 1) * 10) );} int GetThirdDuoArgument(int arg) {return arg - (arg >> 0) + ( GetDigit(arg, -2) + (GetDigit(arg, -1) * 10) );} int GetFourthDuoArgument(int arg) {return arg - (arg >> 0) + ( GetDigit(arg, -4) + (GetDigit(arg, -3) * 10) );} // int GetHighTriArgument (max value 255) // int GetHighMidArgument (max value 999) // int GetHighLowArgument (max value 999) // Example Value: 12345.6789 becomes 123 (high), 456 (mid) and 789 (low); (123)(456)(789) -- (123)(45.6)(789). // int GetFirstDuoArgument = (max value 99) // int GetSecondDuoArgument = (max value 99) // int GetThirdDuoArgument = (max value 99) // int GetFourthDuoArgument = (max value 99) // Example Value: 01234.5678 becomes 12 (first), 34 (second), 56 (third), and 78 (fourth). // 0(12)(34)(56)(78) -- 0(12)(34).(56)(78) //////////////////// ///////////////// // Example Values // // Translation // //////////////////// ///////////////////////////////////// // D0: 06400.0001 // // D0: (064)(000)(001) // // D1: 00040.0126 // // D1: (000)(400)(126) // // D2: 00008.9050 // // D2: 0(00)(08)(90)(50) // // D3: 00100.2200 // // D3: 0(01)(00)(22)(00) // // D4: // // D4: // // D5: // // D5: // // D6: // // D6: // // D7: 10000.0000 // // D7: (1)(0)(0)(0)(0)(0)(0)(0)(0) // //////////////////// /////////////////////////////////////