New forum theme up and running!
globalvar messageList,messageTimes;messageList = ds_queue_create();messageTimes = ds_queue_create();//These two globals carry the message queue.//The first one carries the actual messages, while the latter one carries the amount of time that the message should be displayed for, in seconds.displaying = false //If we are currently displaying a messagetimer = 0 //The countdown timer.message = " " //Empty message variable.
if !ds_queue_empty(messageList) and !displaying{ //If we aren't displaying something, and there's something still in the queue. message = ds_queue_dequeue(messageList) //Load up the new message timer = ds_queue_dequeue(messageTimes) //As well as the time for said message displaying = true} //And make it display.if displaying and timer > 0{ //If the timer is still going timer -= 1} //Then make it goelse{ displaying = false} //Otherwise, stop displaying the message.
if displaying{ //If we're displaying draw_info(message)} //Draw our stuff.
//message_add("message", time)//Adds a message to the message list, to be shown later.ds_queue_enqueue(messageList,argument0) //Add the new message to the queueif argument1 = 0 then argument1 = 3 //If argument1 is empty, then default to three seconds (change at your leisure)ds_queue_enqueue(messageTimes,room_speed*argument1)//room_speed is, of course, how many frames per second the room is running at. //If you multiply that by a number, you get seconds. Very simple math, actually.//That's...it, actually.
//draw_window(sprite,x,y,width,height,subimg,alpha)//OR//draw_window(sprite,x,y,width,height,0,alpha,clr1,clr2)//DESCRIPTION://Draws an RPG-Maker type window using 9 tiles on a 3x3 grid for border//and, either a tiled subimage OR a color gradient used as a background,//centered at an x,y position. If you want the color gradient fill only, //set the 'subimg' argument to 0 and provide the top and bottom colors.//If you want to use a stretched subimage to fill the background, select//a subimage and use -1 where clr1 would be but leave out argument clr2.//This script is very versatile. It should easily support transparency.//NOTE://The second subimage (unless using GM8) should have the bottom row of//pixels completely transparent. If you're using GM8, remove the -1 on//the indicated line below so you can use the full subimage canvas. It//is commented just before the "Draw Background Color Gradient" line.//By Acevar spr, x1, y1, w, h, hcell, vcell, hoff, voff, i, j, ts,alpha; spr=argument0x1=argument1-ceil(argument3/2)y1=argument2-ceil(argument4/2)w=argument3h=argument4//tile sizets=ceil(sprite_get_width(spr)/3);if argument3<ts then w=tsif argument4<ts then h=ts//if the window is too small, draw nothingif argument3<ts or argument4<ts then exit;alpha = argument6 hcell=ceil(w/ts)-2vcell=ceil(h/ts)-2hoff=(w-(hcell*ts))/2voff=(h-(vcell*ts))/2//Draw Background Sprite Tiledif argument5>0 && argument7!=-1{ var sprite,subimg,xx,yy,x1,y1,x2,y2; sprite = argument0; subimg = argument5; xx = x1+1; yy = y1+1; xx1 = x1+1; yy1 = y1+1; xx2 = x1+w-3; yy2 = y1+h-3; var sw,sh,i,j,jj,left,top,width,height,X,Y; sw = sprite_get_width(sprite); sh = sprite_get_height(sprite); i = xx1-((xx1 mod sw) - (xx mod sw)) - sw*((xx1 mod sw)<(xx mod sw)); j = yy1-((yy1 mod sh) - (yy mod sh)) - sh*((yy1 mod sh)<(yy mod sh)); jj = j; for(i=i; i<=xx2; i+=sw) { for(j=j; j<=yy2; j+=sh) { if(i <= xx1) left = xx1-i; else left = 0; X = i+left; if(j <= yy1) top = yy1-j; else top = 0; Y = j+top; if(xx2 <= i+sw) width = ((sw)-(i+sw-xx2)+1)-left; else width = sw-left; if(yy2 <= j+sh) height = ((sh)-(j+sh-yy2)+1)-top; else height = sh-top; //Remove the -1 on the line below (right after the "top" part) if you're using GM8 draw_sprite_part(sprite,subimg,left,top,width,height,X,Y); } j = jj; }}//Draw Background Color Gradientelseif argument7=-1then draw_sprite_stretched(argument0,argument5,x1+1,y1+1,w-3,h-3)else draw_rectangle_color(x1+1,y1+1,x1+w-3,y1+h-3,argument6,argument6,argument7,argument7,0)//horizontal borderfor (i=0;i<hcell;i+=1){draw_sprite_part(spr,0,ts,0,ts,ts,x1+(i*ts)+hoff,y1)draw_sprite_part(spr,0,ts,ts*2,ts,ts-1,x1+(i*ts)+hoff,y1+h-ts)}//vertical borderfor (j=0;j<vcell;j+=1){draw_sprite_part(spr,0,0,ts,ts,ts,x1,y1+(j*ts)+voff)draw_sprite_part(spr,0,ts*2,ts,ts-1,ts,x1+w-ts,y1+(j*ts)+voff)}//cornersdraw_sprite_part(spr,0,0,0,ts,ts,x1,y1) //left topdraw_sprite_part(spr,0,ts*2,0,ts-1,ts,x1+w-ts,y1)//right topdraw_sprite_part(spr,0,0,ts*2,ts,ts-1,x1,y1+h-ts)//left bottomdraw_sprite_part(spr,0,ts*2,ts*2,ts-1,ts-1,x1+w-ts,y1+h-ts) //right bottom
//lineformat(str,maxchrs)//DESCRIPTION://Inserts a line break '#' after a certain number of characters.//If the break lands on a character other than a space, it will//be inserted at the last space it came across.var count, lastspace, i, char;count=0lastspace=0for (i=1; i<=string_length(argument0); i+=1) {char=string_copy(argument0,i,1)count+=1if char=" " { lastspace=i }else if char="#" { lastspace=0; count=0 }if count>=argument1 {if lastspace>0 {count=0i=lastspacelastspace=0argument0=string_insert("#",string_delete(argument0,i,1),i)}}}return(argument0)
var str;str = lineformat(argument,32) //Format our message, so that it's not HOLY **** huge. Change 32 to something else if you so desire.draw_window(sprWindow,view_xview[0]+view_wview[0]-(string_width(str)/2)-8,view_yview[0]+view_hview[0]-(string_height(str)/2)-8,string_width(str)+12,string_height(str)+12,1)draw_text_color(view_xview[0]+view_wview[0]-string_width(str)-8,view_yview[0]+view_hview[0]-string_height(str)-8,str, c_white, c_white, c_white, c_white, 0.75)
Ellie: I had a slice of ham in my hand. I was going to drop it, so I slapped it hard. It attached itself to the wall