What is the 3rd Party HSI?

From OHRRPGCE-Wiki
Jump to: navigation, search

About[edit]

The 3rd Party HSI is a collection of useful plotscripts from various OHRRPGCE plotscripters. FyreWulff originally maintained the collection. The latest version is 1.9, released May 3rd 2014. Its scope is quite narrow, but you might find a few useful scripts here.

If you want to make useful scripts available, the best way to do so is to create a new page on the wiki (add a Scripts: prefix to the page name), and add it to Category:Example Scripts

Contributors[edit]

FyreWulff
TMC
T-Master
Cube
Codywatts


Contributors, please add documentation for your scripts on this page

Usage of the 3rd Party HSI[edit]

To use the 3rd Party HSI, go here: Scripts:3rd Party HSI and copy paste the code into a new text file. Save the file as thirdparty.hsi (or anything else you want). Make sure you don't save the file as .hsi.txt if you are on Windows.

Finally, type in the line "include, thirdparty.hsi" at the top of your script. The top of your script file should look something like this:

#my script file! © me!
include, thirdparty.hsi

You can start your first plotscript just below the include line.

The Scripts[edit]

bounded multiply (a, b)[edit]

Normally multiplications can 'overflow' is the result is too large or small. This script multiples two numbers and returns either the result or 2147483647 or -2147483647 if the multiplication overflows.

cosine (angle, multiplier)[edit]

Returns the cosine of an angle (in degrees), multiplied by some number (default 10000, to give the first 4 decimal digits). You can use any angle or multiplier at all. Note that this function does not give perfect results, when using a large multiplier the answer may be out by a few.

A use of the sine and cosine scripts is to calculate the co-ordinates on the edge of a circle (see example) You can use the 'multiplier, times cosine, angle' operator if you want.

Ex: 
x coord := radius, times cosine, (direction * 45)
y coord := radius, times sine, (direction * 45)

delete all items[edit]

Remove every item from the inventory. Doesn't affect equipment.

digit (number,n)[edit]

Returns nth decimal of a number. Counts from the smallest place, with the ones digit being n = 1, ten's is n = 2, etc.
Ex: digit (12345, 2) = 4

distance (number1,number2)[edit]

Calculates the distance between two numbers. Always returned as a non-negative number.

divide round (a,b)[edit]

Division which rounds the result. Normal division using 'divide(a,b)' or 'a / b' does not round.
You can use the operator a, div, b instead. Ex: nearest tile := hero pixel x (me), div, 20

exp1000(n1000)[edit]

Computes an exponent. This returns 1000 * exp(n / 1000) where n is an integer, so pass 1000 times the value you want to exponentiate. For example, exp1000(1000) returns 2718, which is 1000 times Euler's constant. Also, the result is always at least 1 even if n1000 is a large negative value. If n1000 > 0, the maximum error in the result is 0.3%.

Note that no logarithm function is provided.

fake door (map, x, y)[edit]

Teleports the player to the specified coordinate on some map without using builtin doors.

number of npcs (low range, high range)[edit]

By default (when passing no arguments to it), returns the total number of npc instances on the map. You can set the low and high limits of the npc id numbers it checks for, for instance, 'number of npcs (5, 8)' will return the total number of npcs on the map with id numbers between (and including) 5 and 8.

reset time[edit]

Reset the OHRRPGCE's internal time clock. A save file created right after this command would read 0 days, 0 hours, and 0 minutes.

restore vehicle[edit]

After calling save vehicle, you can use this command to restore the NPC as you left it. This command assumes you have placed the NPC somewhere on the map in CUSTOM.EXE already. The best place to use this script would be in the On Map Load script.

save vehicle(npc)[edit]

Saves the direction, x, y, and ID of the vehicle NPC specified. For use with restore vehicle. The best way to use this command would be in a dismount script. Note that you can only currently save one vehicle at a time.

sine (angle, multiplier)[edit]

Sine behaves in the same way as cosine. It has its own operator, 'multiplier, times sine, angle'.

tan (angle, multiplier)[edit]

tan returns the tangent of a angle times some multiplier. It behaves in the same way as sine. tan has its own operator, 'multiplier, times tan, angle'. The maximum error in the result may be quite large for some multipliers, like 9%. For most (including multiplier=1000) it is more like 1%.

tb (textbox)[edit]

Displays textbox number and then automatic waits for the textbox.

trunc(dividend, divisor)[edit]

Returns the truncation of the dividend and divisor. This is the same as dividend / divisor except that the result is rounded towards 0 instead of downwards. For example trunc(-1600, 1000) is -1 rather than -2.

unequip party (group)[edit]

Removes all equipment from party members. If you use entire party as the group, it will unequip the active and reserve heroes. You can also use active only to unequip just the active party or reserve only to unequip just the reserve heroes. If you use no arguement, it defaults to entire party.

x distance (hero,npc)[edit]

A simplied version of distance that finds the x distance between the specified hero rank in the party, and the specified NPC.

y distance (hero,npc)[edit]

A simplied version of distance that finds the y distance between the specified hero rank in the party, and the specified NPC.


See Also[edit]