Skip to content

Instantly share code, notes, and snippets.

View cacciatc's full-sized avatar

Chris Cacciatore cacciatc

View GitHub Profile
@cacciatc
cacciatc / fcuex_deb.rb
Created May 2, 2016 21:43
FCEUX Deb Format Codified in BinData
class Bookmark < BinData::Record
endian :little
uint32 :address
uint32 :name_length
string :name, :read_length => :name_length
end
class Breakpoint < BinData::Record
endian :little
uint32 :start_address, :inital_value => 0
@cacciatc
cacciatc / texture-fun.js
Last active December 15, 2015 07:39
Texture generation.
/*
* usage: /js generate_texture(width, height)
*
* notes: comment out one of the blocks in the generate_texture method to get started
* or play with the make_discrete function to get different colors.
*/
load(__folder + "core/scriptcraft.js");
function make_discrete(noise){
var val = parseInt(noise)+1;
@cacciatc
cacciatc / partial-templating.html
Created March 19, 2013 16:12
Partial template example.
<tr>
<td>
{{players[0].points}}
</td>
<td>
{{players[0].name}}
</td>
<td>
{{players[0].post}}
</td>
@cacciatc
cacciatc / table.html
Created March 19, 2013 15:33
Plain old HTML rows.
<tr>
<td>
1,048.50
</td>
<td>
Cabrera, Miguel
</td>
<td>
3B
</td>
@cacciatc
cacciatc / players.js
Last active December 15, 2015 03:49
Example players JSON stored in a scope.
$scope.players = {[
{ name:"Cabrera, Miguel", pos:"3B", team:"DET", slg:0.606, obp:0.393 },
{ name:"Braun, Ryan", pos:"OF", team:"MIL", slg:0.595, obp:0.391 }]};
@cacciatc
cacciatc / ng-repeat-example.html
Last active December 15, 2015 03:19
ngRepeat Example
<tr ng-repeat="player in players">
<td>
{{player.score | number:2}}
</td>
<td>
{{player.name}}
</td>
<td>
{{player.pos}}
</td>
@cacciatc
cacciatc / using-bukkit-scheduler.js
Last active December 14, 2015 08:49
Example of using the Bukkit Scheduler from ScriptCraft.
load(__folder + "../drone/drone.js");
load(__folder + "../core/scriptcraft.js");
Drone.extend("big",function(){
server.scheduler.scheduleAsyncDelayedTask(global.plugin,function(){
(new Drone()).box(1,500,100,500);
print("done");
});
});
@cacciatc
cacciatc / skeleton-quest.js
Last active December 12, 2015 10:09
skeleton-quest
load(__folder + "../core/scriptcraft");
var quest = quest || plugin("quest",{
initialize_quest:function(player_name){
quest.store.players[player_name] = {
current:-1,
accepted:false,
skeleton_counter:0,
steps:[{
step:1,
@cacciatc
cacciatc / accept-and-skeleton.js
Created February 11, 2013 20:26
Accept and skeleton listener.
skeleton_kill_counter:function(event,data){
var target = data.getEntity();
var killer = target.getKiller();
// check if it is the player who did the killing and if a skeleton was the target
if(killer != null && killer.getUniqueId() == getPlayerObject().getUniqueId() && target.getType() == org.bukkit.entity.EntityType.SKELETON && quest.store.players[killer.name] != null){
quest.store.players[killer.name].skeleton_counter = (quest.store.players[killer.name].skeleton_counter + 1);
if(quest.store.players[killer.name].skeleton_counter < 10){
killer.sendMessage("" + quest.store.players[killer.name].skeleton_counter + "/10 skeletons killed.");
}
else{
@cacciatc
cacciatc / proc-quest.js
Created February 11, 2013 20:19
Villager interaction logic.
proc_quest:function(event,data){
// make sure we are interacting with the quest giver
var target = data.getRightClicked();
var player = data.getPlayer();
if(quest.store.npcs[target.getUniqueId()] != null){
// get the player's current quest progress
var quest_progress = quest.store.players[player.name];
if(quest_progress == null){
quest.initialize_quest(player.name);