Skip to content

Instantly share code, notes, and snippets.

@allanon
allanon / items_control_upgrade.md
Last active September 20, 2016 17:01
A new items_control.txt format, a new plugin for parsing the data in it, and an upgrade path for the old file.

items_control_upgrade.pl plugin

Manage the upgrade path from the old items_control.txt to items_control_new.txt.

  1. On load, check whether a control/items_control.txt file exists and has uncommented lines in it. If so:
  2. If a control/items_control_new.txt file already exists, display a warning, then go to step 2.
  3. If a control/items_control_old.txt file already exists, display a warning, then go to step 2.
  4. Display a message to the user, offering to upgrade the control/items_control.txt file to control/items_control_new.txt. If the user DOES NOT accept, go to step 2.
  5. Rename control/items_control.txt to control/items_control.txt.old.
  6. Load control/items_control.txt.old and convert the contents to the correct format for control/items_control_new.txt.
  7. Save control/items_control_new.txt.
@allanon
allanon / autotalk.spl
Created November 4, 2016 21:46
autotalk.spl: Automatically respond to automatic conversations (triggered by walking nearby) from certain NPCs.
# This is a Simple plugin: https://github.com/allanon/openkore-addons/blob/master/plugins/simple.pl
our $name = 'autotalk';
our $desc = 'Automatically respond to automatic conversations (triggered by walking nearby) from certain NPCs.';
=pod Example configuration:
# Turn on the plugin.
autotalk 1
# Automatically cancel Halloween quest NPC conversation.
@allanon
allanon / .perltidyrc
Created June 15, 2017 20:12
perltidyrc for OpenKore dev work
# max line width is 132 cols
-l=132
# indent level is 4 cols
-i=4
# entab at 4 cols
-et=4
# continuation indent is 4 cols
@allanon
allanon / gist:44bc272a56f1727deaf6e5fbe534c3c4
Last active July 30, 2017 06:09
use pots between 40% and 90%
doCommand eval $flags{hp_was_below_40} = 1 {
whenNotFlag hp_was_below_40
hp < 40%
}
doCommand eval $flags{hp_was_below_40} = 0 {
whenFlag hp_was_below_40
hp > 90%
}
useSelf_item Concentration Potion {
label awake
timeout 120
inLockOnly 1
whenStatusInactive Concentration Potion
disabled 0
}
useSelf_item Awakening Potion {
label awake
@allanon
allanon / macros.txt
Created August 2, 2017 13:52
Get as much from storage as possible.
# This only works for stackable items.
# Assume storage is already open.
macro storage_get_amap {
$params = $.param1
# Maximum target character weight, as a percentage.
$maxweight = 90
[
$i = @storage ($params)
@allanon
allanon / eventMacros.txt
Last active August 28, 2017 20:33
part of the Assassin job quest
# Hack the field to make the pits unwalkable. Then set route_step to 2 so kore will fully avoid them.
macro job_assassin_2 {
[
# Add npcs to map as unwalkable tiles.
@poss = (62 168,62 169,63 168,63 169,64 162,64 163,64 174,64 175,65 162,65 163,65 170,65 174,65 175,66 155,66 170,66 171,67 170,67 171,68 158,68 159,69 158,69 159,72 166,72 167,72 168,72 169,72 174,72 175,73 166,73 167,73 168,73 169,73 172,73 174,73 175,76 158,78 168,78 169,79 168,79 169,80 172,80 173,81 172,81 173,82 172,82 173,83 172,83 173,84 150,84 160,84 161,85 160,85 161,86 154,86 155,86 160,86 161,86 166,86 167,87 154,87 155,87 160,87 161,87 166,87 167,88 160,88 161,88 162,88 172,88 174,88 175,89 160,89 161,89 174,89 175,90 164,90 165,91 164,91 165)
while (@poss > 0) {
$pos = &shift(@poss)
@xy = &split(' ', $pos)
$junk = &eval(substr($::field->{dstMap}, $::field->width * $xy[1] + $xy[0], 1) = chr 0)
#log $pos ord substr &eval($::field->width) * $xy[1] + $xy[0], 1
@allanon
allanon / eventMacros.txt
Last active June 20, 2018 13:37
quest_talk and friends
# Some usage examples:
# call quest_talk alberta_in '180 30' "r0 r~/Aldebaran/ r~/3 zeny/ r~/need a cart/ r~/Alberta/ r~/5 O'clock/ r~/Claymore/ r~/Mink Coat/ r~/4/ r~/ANOLIAN/ r~/Money/"
# call quest_talk alberta_in '28 29' 'r0 r3 d3543625 r0'
# call quest_talk_dist $map '$pos' 13 '$pos' "$talk"
# call quest_talk geffen_in '110 169' 'e'
# call quest_talk geffen_in '110 169' 'r0'
# call quest_talk morocc '95 133' "r0 r~/Ask him what he needs/ r~/Alberta/ r~/5 O'clock/ r~/Geffen/ r~/DEX/"
# call quest_talk new_1-4 '100 29' r1 r0 r1 r2 r1 r0 r1 r0 r1 r0 r1 r1 r0 r1 r1 r1 r0 r2 r1 r0 r1 r3 r0 r0'
# call quest_talk new_1-4 '100 29' 'r1 r3 r0 r0 r0 r1 r0 r0 r0 r0 r1 r0 r1 r0 r0 r2 r2 r1 r0 r2 r2 r1 r1 r0'
@allanon
allanon / event
Created August 14, 2017 22:01
restart swordsman quest
macro job_swordsman {
# Swordsman
call quest_talk izlude_in '74 172' 'r0 r0 r0'
# => quest 1014
# Swordsman (teleporter)
call quest_talk izlude_in '62 170' 'e'
# => tele izlude_in 39 170
# Test Hall Staff
## Ores #######################################################################
forge Iron {
skill Iron Tempering
useItem Mini Furnace
item_0 Iron Ore 1
}
forge Steel {
skill Steel Tempering
useItem Mini Furnace