http://wiki.graal.us/
|
|
Join Date: Nov 2001
Posts: 2,247
|
|
Live Demo: Testbed Server Weapon: Shared/AniTextDemo
Alternate Demo: Repeats player's chat, showing it on the bottom of the screen. Weapon: Public/adam/AniText
If somebody could try it in opengl mode, and with v6 and tell me how it performs that'd be great. Remember it's my birthday, do it.
Sorry no video this time, wasn't ready to do another one of those o.O
Still a few things to add, but just about every animation possible is added now.
The demo script wasn't meant to be pretty, just randomly animates everything possible. Although it is fun to watch. I suggest trying it out in opengl mode if you can, if you run V6 please let me know how it works too.
PHP Code:
//NPC Created by Rogue Shadow (TCN) //AIM: RogueTCN //FORUM PM: adam // Special messaging prototype 4
//#CLIENTSIDE
// Actions format {"var", time, newvalue} // string these blocks together for simultanous actions // add them in succession for sequences. // or any combination thereof function onCreated(){ this.join("personal_adam_anitext"); sleep(.01);// class seems to need just a moment. this.m = newText(this, 200, screenwidth/3, screenheight/3, "Testing Text", true); this.m.A( {{"alpha", 1, 1}} ); this.m.A( {{"delay", 1}}); for (temp.i=0;temp.i<20;temp.i++){ this.m.A( {{"alpha",1,random(0,1)},{"x",1,random(0,screenwidth)},{"y",1,random(0,screenheight)},{"zoom",1,random(.1,5)},{"bgPadding",1,random(2,50)},{"outline",.5,random(1,50)},{"oBlue", 1, random(0,1)},{"oRed", 1, random(0,1)},{"oGreen",1,random(0,1)},{"tBlue", 1, random(0,1)},{"tRed", 1, random(0,1)},{"tGreen",1,random(0,1)},{"bBlue", 1, random(0,1)},{"bRed", 1, random(0,1)},{"bGreen",1,random(0,1)}}); } this.m.A( {{"alpha",1,1},{"x",1,screenwidth/2},{"y",1,screenheight/2},{"zoom",1,1},{"bgPadding",1,2},{"outline", 1, 1},{"tRed", 1, 1},{"tGreen",1,1},{"tBlue",1,1},{"bRed",1,0},{"bGreen",1,0},{"bBlue",1,0},{"oRed",1,1},{"oBlue",1,1},{"oGreen",1,1}}); this.m.start(); }
PHP Code:
//#CLIENTSIDE
function newText(temp.scope, temp.start_i, temp.x, temp.y, temp.text, temp.useBackground){ // Various Declarations to start with. temp.t = new TStaticVar(); temp.t.global = temp.scope; temp.t.start_i = temp.start_i; temp.t.x = temp.x; temp.t.y = temp.y; temp.t.tRed = 1; temp.t.tGreen = 1; temp.t.tBlue = 1; temp.t.alpha = 0; temp.t.layer = 10*temp.start_i; temp.t.font = "Comic Sans MS"; temp.t.style = ""; temp.t.zoom = 1; temp.t.text = temp.text; temp.t.width = gettextwidth(temp.t.zoom, temp.t.font, "", temp.t.text); temp.t.height = gettextheight(temp.t.zoom, temp.t.font, ""); temp.t.delay = true; temp.t.animatable = {"delay","x","y","zoom","alpha","bgPadding","outline","tRed","tBlue","tGreen","bRed","bBlue","bGreen","oRed","oGreen","oBlue"}; temp.t.queue = {}; if (temp.useBackground != null){ temp.t.background = useBackground; temp.t.bgPadding = 2; temp.t.outline = 2; temp.t.bRed = 0; temp.t.bGreen = 0; temp.t.bBlue = 0; temp.t.oRed = 1; temp.t.oGreen = 1; temp.t.oBlue = 1; } temp.t.start = function () { this.started = true; this.onUpdate(); }; temp.t.stop = function () { this.started = false; }; temp.t.A = function ( temp.actions ) { this.queue.add( temp.actions ); this.count++; };
temp.t.onUpdate = function () { if (!this.started)return; for (temp.action: this.queue[0]){ if (temp.action[0] in {"NewText"}){ if (this.(@temp.action[0])(temp.action)){ this.queue[0].remove(temp.action); } }elseif(temp.action[0] in this.animatable){ if (this.doValue(temp.action)){ this.queue[0].remove(temp.action); } }else this.queue[0].remove(temp.action); } if (this.queue[0].size() == 0 && this.queue.size() > 0) this.queue.delete(0); this.draw(); this.scheduleevent(0.05, "Update", null); };
temp.t.doValue = function (action) { temp.value = temp.action[0]; temp.time = temp.action[1]; temp.newvalue = temp.action[2]; if (temp.time == 0){ this.(@value) = temp.newvalue; return true; } if (this.(@value).dist == null){ this.(@value).dist = temp.newvalue - this.(@value); this.(@value).step = this.(@value).dist / (temp.time*20); } if (abs ( temp.newvalue - this.(@value)) <= this.(@value).step){ this.(@value) = temp.newvalue; }else this.(@value) += this.(@value).step; if (temp.value == "zoom")this.NewText({"NewText",this.text}); if (this.(@value) == temp.newvalue){ this.(@value).dist = null; this.(@value).step = null; this.delay = true; return true; }else return false; };
temp.t.NewText = function (action) { this.text = temp.action[1]; this.width = gettextwidth(this.zoom, this.font, "", this.text); this.height = gettextheight(this.zoom, this.font, ""); return true; };
temp.t.draw = function (){ temp.i = this.start_i; with (this.global.findimg(temp.i)){ x = thiso.x; y = thiso.y; text = thiso.text; red = thiso.tRed; green = thiso.tGreen; blue = thiso.tBlue; zoom = thiso.zoom; font = thiso.font; style = thiso.style; layer = thiso.layer; alpha = thiso.alpha; mode = 1; } temp.i++; if (!this.background) return temp.i; with (this.global.findimg(temp.i)){ temp.xx=thiso.x;temp.yy=thiso.y;temp.w=thiso.width;temp.h=thiso.height;temp.p=thiso.bgPadding; polygon = {xx-p,yy-p, xx+w+p,yy-p, xx+w+p,yy+h+p, xx-p,yy+h+p}; temp.p2 = temp.p+thiso.outline; temp.poly2 = {xx-p2,yy-p2, xx+w+p2,yy-p2, xx+w+p2,yy+h+p2, xx-p2,yy+h+p2};
layer = thiso.layer - 1; red = thiso.bRed; green = thiso.bGreen; blue = thiso.bBlue; alpha = thiso.alpha; mode = 1; } temp.i++; with (this.global.findimg(temp.i)){ polygon = temp.poly2; layer = thiso.layer -2; red = thiso.oRed; green = thiso.oGreen; blue = thiso.oBlue; alpha = thiso.alpha; mode = 1; } temp.i++; this.lasti = temp.i; return temp.i; }; return temp.t; }
|
__________________
Rogue Shadow (TCN)(NAT)(Global Development Team)
For development help, contact the patrons of the #graaldt irc channel below, I am usually there.
Click Here to Join IRC Chat Now! -- irc.freenode.net Channel: #graaldt
Quote:
<Dustyshouri> no, RogueShadow is always talking about scripts lol
<Dustyshouri> in fact, he pretty much brought Graal back as a topic single-handedly
|
|
Last edited by adam; 08-24-2010 at 05:33 AM..
|