Skip to content

Instantly share code, notes, and snippets.

View collinticer's full-sized avatar

Collin Ticer collinticer

View GitHub Profile
var instance = argument0;//instance should be a "standard_obj" with the objectProperties attribute
var dialogToAdd = argument1;//instance should be a "new_dialog"
with( instance )
{
var tmpObjProps = instance.objectProperties;
var dialogsList = tmpObjProps[? "dialogs"];
ds_list_add( dialogsList, dialogToAdd );
var instance = argument0;//instance should be a "standard_obj" with the objectProperties attribute
var textToAdd = argument1;//the text the new "new_dialog" obj should init
var typeOfDialog = argument2;//dialog type of click or delay. default to click
var delayTiming = argument3;//delay time in seconds if typeOfDialog is delay. default is 3 seconds
with( instance )
{
var tmpDialog = new_dialog();
ds_map_set( tmpDialog, "text", textToAdd );
//the x and y coordinates of the crosshair center
var objectX = argument0;
var objectY = argument1;
//how far away to draw the track/circle
var distanceAway = argument2;
//width of the line of the circle
var width = argument3;
//the length of the pointer arrow
var x1OfLine = lengthdir_x( distanceAway , currentMouseDirection );
var x2OfLine = lengthdir_x( distanceAway + pointerLength, currentMouseDirection );
var y1OfLine = lengthdir_y( distanceAway , currentMouseDirection );
var y2OfLine = lengthdir_y( distanceAway + pointerLength, currentMouseDirection );
if( objectProperties[? "current_dialog"] == false && ds_list_size( objectProperties[? "dialogs"] ) > 0 )
{
var tmpDialogList = objectProperties[? "dialogs"];
var dialogObj = tmpDialogList[|0];
ds_map_set( objectProperties, "current_dialog", dialogObj );
ds_list_delete( objectProperties[? "dialogs"], 0 );
}
var dialogObj = objectProperties[? "current_dialog"];
//if we're not currently in dialog and there's dialog queued up then show it
if( objectProperties[? "in_dialog"] == false && dialogObj != false )
{
ds_map_set( objectProperties, "in_dialog", true );
var newDialogObj = instance_create( x, y - 15, dialog_obj );
newDialogObj.dialogObjToDraw = dialogObj;
newDialogObj.parentInstance = self;
function eight_point_direction( degDirection ) {
return round( degDirection / 45 );
}
function eight_point_coord_direction( xFirst, yFirst, xSecond, ySecond ) {
var tmpDirection = point_direction( xFirst, yFirst, xSecond, ySecond );