Skip to content

Instantly share code, notes, and snippets.

@CherryDT
CherryDT / main.cpp
Created November 1, 2018 11:16
DynRPG Keyboard & Mouse Input Plugin
/*
keyboard_mouse_input
A plugin for RPG Maker 2003
Using DynRPG - the RM2k3 Plugin SDK
This plugin allows you to read the mouse position and the status
of all keys.
By David "Cherry" Trapp
*/
@CherryDT
CherryDT / rm2kX_interpreter_behavior.md
Last active October 16, 2018 23:51
RM2k(3) Event Interpreter Behavior and Order of Event Execution

RM2k(3) Event Interpreter Behavior and Order of Event Execution

(I originally posted this in this comment and slightly updated it now with information regarding events acting earlier than expected.)

As I understand the engine, it is "supposed" to work like this:

Workers

The RM has workers for executing events. A worker is either a generic worker which will try to execute whatever event is waiting for being executed, or a parallel process worker which runs one specific event over and over. (Or a battle worker, but let's leave that aside for now).

@CherryDT
CherryDT / rm2k3_battle_type_behavior.md
Last active October 16, 2018 22:00
RM2k3 Battle Type Behavior

Effect of battle types

First of all, it's a bit weird because the battle type may not be what was set originally: Surprise is converted to initiative if the battler placement is "manual" or there is only 1 actor in the party. Pincers is converted to back if the battler placement is "manual" or there is only 1 enemy in the monster group. (Including the different effects on calculations explained below!)

It affects the placement of the battlers of course (position and mirroring).

Escape handling:

  • If initiative battle or surprise battle (same as if "first strike" flag is set): Escaping via fight/auto/run menu possible during first turn; "Caught the enemy off-guard" message displayed at battle start
  • If surprise battle: Enemies attempting to escape always fail (their escape action is converted to a "do nothing" action when executed)
@@ -116,7 +116,7 @@
def format(self, filename, line, timestamp, **kwargs):
"""Returns a formatted log line"""
- line = unicode(line.encode("utf-8")[:32766], "utf-8", errors="ignore")
+ line = unicode(line.encode("utf-8"), "utf-8", errors="ignore")
formatter = self._beaver_config.get_field('format', filename)
if formatter not in self._formatters:
formatter = self._default_formatter
@CherryDT
CherryDT / accidentalEuler.js
Created May 2, 2017 17:00
Another way to stumble upon Euler and his weird and magical constant.
function estimateEulersConstant () {
const SAMPLES = 10000000;
let s = 0;
for (let n = 0; n < SAMPLES; n++) {
let x = 0;
let i = 0;
while (x < 1) {
x += Math.random();
@CherryDT
CherryDT / dynrpg_comment_parser_v0.20.bas
Created April 10, 2017 15:06
DynRPG Comment Parser (v0.20)
' For reference: The DynRPG comment parsing routine.
' It is optimized for speed more than for readability. (It even has a GoTo, yikes.)
' From DynRPG version 0.20
' (C) David "Cherry" Trapp 2013
' cherry@cherrytree.at
Sub ParseComment(text As ZString Ptr)
With CommentData
.command[0] = 0
.parametersCount = 0
@CherryDT
CherryDT / file_obj_standalone.bi
Created January 17, 2017 17:19
Object-oriented file and memory stream input/output library for FreeBasic
/'
Copyright (C) 2006-2017, David "Cherry" Trapp
All rights reserved.
1. Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the conditions laid out in the
following paragraphs are met.
2. Redistributions of source code (if available) must retain the above
copyright notice, this list of conditions and the following disclaimer.
@CherryDT
CherryDT / registry_standalone.bi
Created January 17, 2017 17:17
Simplified Windows registry reader/writer library for FreeBasic
' By David "Cherry" Trapp (2009)
' Fork of RegLib by porfirio: http://www.freebasic.net/forum/viewtopic.php?t=7072
Namespace RegObj
#Define REG_KEY_NOT_EXIST "REG_KEY_NOT_EXIST"
#Define REG_KEY_INVALID "REG_KEY_INVALID"
Type RegLib
Declare Constructor(root As HKEY,Key As String, create As Boolean=false, acc As Integer = KEY_ALL_ACCESS)