Graal Forums  

Go Back   Graal Forums > Development Forums > NPC Scripting > Code Gallery
FAQ Members List Calendar Today's Posts

 
 
Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #10  
Old 06-01-2012, 03:34 AM
Tolnaftate2004 Tolnaftate2004 is offline
penguin.
Join Date: Jul 2004
Location: Berkeley, CA
Posts: 534
Tolnaftate2004 is a jewel in the roughTolnaftate2004 is a jewel in the rough
Send a message via AIM to Tolnaftate2004
http://forums.graalonline.com/forums...ad.php?t=79671

Also with regards to chaining, I've been hanging on to this because I wanted to make it more extensible (like jQuery), but I've yet to devise an elegant solution. Anyway, you can check out the attachments. It includes some tweening functionality (specifically, linear and sinusiodal). Here's an example, the Zenkou message system.

PHP Code:
// Zenkou Messaging System (Growl Edition!)
// Styled after Growl (http://growl.info)
// v0.1

function onCreated() { this.join("boilerplate"); }

//#CLIENTSIDE
const PRE "zen_messages_";

function 
getlock() {
  if (
this.lock) {
    while (!
waitfor(this.name"onMessage" this.num));
    
this.num++;
  }
  
this.lock true;
  return;
}

function 
release() {
  if (
this.lock) {
    
this.lock false;
    
this.trigger("Message" this.numNULL);
  }
  return;
}

function 
growl(stitletexticontime) {
  if (
text 0) { time texttext stitlestitle ""icon "alert"; }
  if (
icon 0)  { time iconicon texttext stitlestitle ""; }
  if (
time == 0) { time 10; }
  if (
text == "") { text stitlestitle ""; }
  
  echo(
"[" int(timevar2) @ "] " stitle); echo(text);
  
temp.lines wraptext2(2382/3" -""@verdana@@" text);
  
temp.ys = {};
  
temp.max(3218 * (temp.stitle != "") + 16 temp.lines.size());
  for (
temp.0temp.temp.lines.size(); temp.i++)
    
temp.ys.add(16 * (temp.stitle != "") + 16 temp.i);
  
  for (
temp.this.messages.size(); temp.> -1temp.i--) {
    if (
this.messages[temp.i].objecttype() == "TGraalVar")
      
this.messages.delete(temp.i);
    else 
this.messages[temp.i].duplicate().set("y""+=" @ (temp.10));
  }
  
  
temp.sw screenwidth;
  
temp.bg = $()
    .
images(9200)
    .
set("image"PRE "blackbox.png")
    .
set("layer"7)
    .
set("alpha"1)
    .
set("mode"1)
    .
set("zoom"1)
    .
set("partx", { 01020 })
    .
set("party", { 000101010202020 })
    .
set("partw"10)
    .
set("parth" 10)
    .
set("stretchx", { 128})
    .
set("stretchy", { 111temp.h/10-1temp.h/10-1temp.h/10-111})
    .
set("x", { temp.sw 303temp.sw 158temp.sw 13 })
    .
set("y", { 4444+temp.h/24+temp.h/24+temp.h/24+temp.h4+temp.h4+temp.})
  ;
  if ( 
stitle != "" ) {
    
temp.title = $()
      .
images(1200)
      .
set("text"stitle)
      .
set("zoom"0.7)
      .
set("font""verdana")
      .
set("style""b")
      .
set("layer"8)
      .
set("x"temp.sw 251)
      .
set("y"4)
    ;
  }
  
temp.desc = $()
    .
images(temp.lines.size(), 200)
    .
set("text"temp.lines)
    .
set("zoom"2/3)
    .
set("font""verdana")
    .
set("layer"8)
    .
set("x"temp.sw 251)
    .
set("y"temp.ys)
  ;
  
temp.icon = $()
    .
images(1200)
    .
set("image"PRE "icon_" icon ".png")
    .
set("layer"8)
    .
set("mode"1)
    .
set("x"temp.sw 294)
    .
set("y"temp.h/9)
  ;
  
  (
temp.merged = $());
  
temp.merged
    
.merge({ temp.bgtemp.titletemp.desctemp.icon })
    .
wait(time)
    .
call(
      
this.clear_out = function (args) {
        
temp.args[0];
        
temp.args[1];
        
temp.on false;
        for (
temp.this.messages.size()-1temp.> -1temp.i--) {
          
temp.msg this.messages[temp.i];
          if (
temp.msg.objecttype() == "TGraalVar") continue;
          if (
temp.msg == temp.qtemp.on true;
          elseif (
temp.on) {
            
temp.msg
              
.duplicate()
              .
tween("y""-=" @ (temp.10), 1)
              .
wait(1)
            ;
          }
        }
      }, { 
temp.mergedtemp.}
    )
    .
tween("alpha"01)
    .
wait(1)
    .
end()
  ;
  
  
this.messages.add(temp.merged);
}

public function 
addmsg(titledescicondur) {
  
getlock();
  
growl(titledescicondur);
  
release();

Of course I was aiming for something a little more sophisticated than a series of chained set()s for image manipulation when I started writing it but meh.
Attached Files
File Type: txt boilerplate.txt (999 Bytes, 221 views)
File Type: txt boilerplate.base.txt (13.6 KB, 241 views)
File Type: txt boilerplate.images.txt (1.1 KB, 225 views)
__________________
◕‿‿◕ · pfa · check yer syntax! · src

Killa Be: when i got that locker in 6th grade the only thing in it was a picture of a midget useing a firehose :/
Reply With Quote
 


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +2. The time now is 10:56 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.
Copyright (C) 1998-2019 Toonslab All Rights Reserved.