All pastes #958275 Raw Edit

dylan's nit-picking

public text v1 · immutable
#958275 ·published 2008-03-26 16:53 UTC
rendered paste body
install {
        agent bubblemanager = newsimple(1, 2, 10, "blnk", 1, 0, 0);
        bubblemanager.attributes = 16;
}

script 1, 2, 10, 126 {
        atomic {
                string text as _p1_;
                agent src as _p2_

                if (src == null)
                        stop();

                numeric xpos;
                if (src == pntr)
                        xpos = src.x;
                else
                        xpos = src.centrex;

                numeric windowcentre = (windowleft + windowright) / 2;
                numeric bubblepose;
                if (xpos < windowcentre)
                        bubblepose = 0;
                else
                        bubblepose = 1;

                agent bubble = newcompound(1, 2, 9, "speech_bubbles", 2, 2, src.plane + 10);
                bubble.tick = 40;
                bubble.attributes = 32 | 8;

                numeric xsize = 0; // this shouldn't generate any code..
                numeric bubblesize = 2;

                while (bubblesize < 8 && bubble.nopages > 1) { // should be UNTL
                        if (bubblesize > 2)
                                bubble.killpart(1);
                        bubble.newpart(1, "speech_bubbles", bubblesize, 0, 0, 0, "blackontransparentchars");
                        bubble.changepart(1);

                        bubble.textformat(12, 12, 12, 5, 0, 0, 0);
                        bubble.pose = bubblepose;
                        bubble.parttext(text);

                        switch (bubblesize) {
                                case 2: xsize = 102;
                                case 4: xsize = 155;
                                case 6: xsize = 230;
                                case 8: xsize = 319;
                        }

                        bubblesize += 2;
                }

                changepart(0);
                bubble.pose = bubblepose;
                if (bubblepose == 1)
                        xpos -= xsize;

                bubble.moveto(xpos, src.top - 30);
                bubble.floatto(src);
        }
}

script 1, 2, 9, 9 {
        owner.kill();
}

remove {
        enum o in (1, 2, 9)  { o.kill(); }
        enum o in (1, 2, 10) { o.kill(); }

        deletescript(1, 2, 9, 9);
        deletescript(1, 2, 10, 126);
}