Tree 1.03

By BlueThen on Oct 11, 2008

First PicWin since August, sadly.

Tree is simply a fancy generator. It animates a tree/shrub like plant thing growing using lines an' such. Not much to it really...
(Press the Space bar to reset it.)

Image

Updates:
Fixed minor draw-error bug.
Restricts two instances of Tree now... seeing as how two instances is not possible, and would crash it.
Added "Aspects" menu.

;Tree 1.03
;Made by BlueThen on October 11, 2008.
;Last updated October 12, 2008.
;To install, put this snippet into your remotes (Alt + R)
;Type /tree or right click the channel or status and click "Tree" to run.
;Press the space bar to reset it.
alias tree {
  if (!$window(@tree)) {
    dialog -m tree.aspect tree.aspect
    dialog -s tree.aspect 100 100 325 227 
    window -paozCdk0 +fbnL @Tree -1 -1 400 400
    window -paohCzdk0 +ndL @tree.buf -1 -1 800 800
    tree.init
  }
}
menu channel,status {
  Tree: { tree }
}
alias -l tree.init {
  clear @tree.buf
  unset %tree.*
  set %tree.life $did(tree.aspect,1).sel
  set %tree.split $did(tree.aspect,2).sel
  set %tree.len $did(tree.aspect,6).sel
  set %tree.siz $did(tree.aspect,8).sel
  set %tree.s n
  set %tree.limbs 1
  drawfill @tree.buf 3 3 1 1
  drawtext @tree.buf 12 Tahoma 30 520 20 Made by BlueThen
  drawtext @tree.buf 12 Tahoma 30 520 60 BlueThen.com
  hadd -m InitAng 1 $r(1,360)
  hadd -m Size 1 $r(15,30)
  hadd -m X 1 400
  hadd -m Y 1 400
  hadd -m Shade 1 0
  hadd -m Life 1 1
  hadd -m Status 1 Alive
  drawcopy @tree.buf 0 0 800 800 @tree 0 0 400 400
  tree.frame
}
alias -l tree.frame {
  if (%tree.s != y) {
    set %tree.x %tree.limbs
    while (%tree.x) {
      if ($hget(status, %tree.x) == alive) {
        if ($r(1, $calc(31 - %tree.split)) == 1) {
          inc %tree.limbs
          hadd -m InitAng %tree.limbs $calc($hget(initang, %tree.x) $iif($r(1,2) == 1, +, -) $r(1,180))
          hadd -m Status %tree.limbs alive
          hadd -m Life %tree.limbs 1
          hadd -m Size %tree.limbs $calc($hget(Size, %tree.x) * $iif($hget(Size, %tree.x) > %tree.siz, 0.95, 1))
          %tree.a = $hget(initAng, %tree.limbs)
          hadd -m X %tree.limbs $calc($hget(X, %tree.x) + (($r(50,100) * ($hget(size, %tree.limbs) * (%tree.len * 0.01))) *  $cos(%tree.a).deg))
          hadd -m Y %tree.limbs $calc($hget(Y, %tree.x) + (($r(50,100) * ($hget(size, %tree.limbs) * (%tree.len * 0.01))) * $sin(%tree.a).deg))
          hadd -m Shade %tree.limbs $calc($hget(Shade, %tree.x) + $iif($hget(Shade, %tree.x) < 230, $r(5,20), 0))
          drawline -r @tree.buf $rgb(139,$hget(Shade, %tree.limbs),19) $hget(size, %tree.limbs) $hget(X, %tree.limbs) $hget(Y, %tree.limbs) $hget(X, %tree.x) $hget(Y, %tree.x)
        }
        %tree.ns = $calc($hget(Size, %tree.x) * $iif($hget(Size, %tree.x) > %tree.siz, 0.95, 1))
        %tree.a = $calc($hget(initang, %tree.x) $iif($r(1,2) == 1, +, -) $r(1,90))
        %tree.nx = $calc($hget(X, %tree.x) + (($r(50,100) * (%tree.ns * (%tree.len * 0.01))) * $cos(%tree.a).deg))
        %tree.ny = $calc($hget(Y, %tree.x) + (($r(50,100) * (%tree.ns * (%tree.len * 0.01))) * $sin(%tree.a).deg))
        hadd -m Shade %tree.x $calc($hget(Shade, %tree.x) + $iif($hget(Shade, %tree.x) < 230, $r(5,20), 0))
        drawline -r @tree.buf $rgb(139,$hget(Shade, %tree.x),19) %tree.ns $hget(X, %tree.x) $hget(Y, %tree.x) %tree.nx %tree.ny
        hadd -m InitAng %tree.x %tree.a
        if ($hget(x, %tree.x) > 600) hadd -m InitAng %tree.x 180
        if ($hget(x, %tree.x) < 200) hadd -m InitAng %tree.x 0
        if ($hget(y, %tree.x) > 600) hadd -m InitAng %tree.x 270
        if ($hget(y, %tree.x) < 200) hadd -m InitAng %tree.x 90
        hadd -m X %tree.x %tree.nx
        hadd -m Y %tree.x %tree.ny
        hadd -m Size %tree.x %tree.ns
        hadd -m Life %tree.x $calc($hget(life, %tree.x) + 1)
        if ($hget(life, %tree.x) > $calc(%tree.life - %tree.limbs)) {
          hadd -m Status %tree.x Dead
        }
      }
      dec %tree.x
    }
    if ($window(@tree)) drawcopy -m @tree.buf 0 0 800 800 @tree 0 0 400 400
    .timer 1 0 tree.frame
  }
  else unset %tree.*
}
on *:keydown:@tree:32: {
  set %tree.s y
  .timer? off
  tree.init
}
on *:close:@tree: { window -c @tree.buf | .timer? off | set %tree.s y | dialog -x tree.aspect }
on *:dialog:tree.aspect:close:0: { window -c @tree | window -c @tree.buf | .timer? off | set %tree.s y }
dialog tree.aspect {
  title "Tree Aspects"
  size -1 -1 325 227
  option pixels notheme
  scroll "", 1, 10 26 300 16, horizontal top range 1 150
  scroll "", 2, 10 74 300 16, horizontal top range 1 30
  text "Limb Life: ", 3, 10 8 100 16
  text "Split Rate: ", 4, 10 54 118 18
  text "Limb Length: ", 5, 10 102 122 16
  scroll "", 6, 10 120 300 16, horizontal top range 1 20
  text "Min. Limb Size:", 7, 10 148 120 18
  scroll "", 8, 10 168 300 16, horizontal top range 1 20
  text "50/150", 9, 212 8 100 16, right
  text "24/30", 10, 212 54 100 18, right
  text "4/20", 11, 212 102 100 16, right
  text "3/20", 12, 212 148 100 18, right
  button "Reset", 14, 129 194 66 24
}
on *:dialog:tree.aspect:scroll:*: {
  if ($did == 1) { set %tree.life $did(1).sel | did -ra tree.aspect 9 $did(1).sel $+ /150 }
  if ($did == 2) { set %tree.split $did(2).sel | did -ra tree.aspect 10 $did(2).sel $+ /30 }
  if ($did == 6) { set %tree.len $did(6).sel | did -ra tree.aspect 11 $did(6).sel $+ /20 }
  if ($did == 8) { set %tree.siz $did(8).sel | did -ra tree.aspect 12 $did(8).sel $+ /20 }
}
on *:dialog:tree.aspect:init:0: {
  tree.reset
}
on *:dialog:tree.aspect:sclick:14: {
  tree.reset
}
alias -l tree.reset {
  did -c tree.aspect 1 100
  did -ra tree.aspect 9 100/150
  did -c tree.aspect 2 24
  did -ra tree.aspect 10 24/30
  did -c tree.aspect 6 4
  did -ra tree.aspect 11 4/20
  did -c tree.aspect 8 3
  did -ra tree.aspect 12 3/20
  set %tree.life 100
  set %tree.split 24
  set %tree.len 4
  set %tree.siz 3
}

Comments

Sign in to comment.
BlueThen   -  Jan 17, 2009

It uses algorithms to draw "shrubbery-like" pictures onto a picture window. Is there any better way of explaining it?

 Respond  
Bluepower10   -  Jan 17, 2009

I don't really understand what it does. What does it do?

 Respond  
NIGathan   -  Jan 16, 2009

Nice, glad I found this :D

9/10

/me +likes

 Respond  
^Neptune   -  Oct 13, 2008

Oh that's much better ^_^

 Respond  
BlueThen   -  Oct 12, 2008

Added "Aspects" menu. It doesn't have much, but I'll add more if I get the chance to. (Colors, starting position, pedals, etc)

 Respond  
NightBlade   -  Oct 12, 2008

I wouldn't mind a large screensaver, large enough to fill screen maybe. well, a continous cycle of pictures/animation/drawings that can be used to cover it, or, anything, by command
I am familiar with some of your work. Bluethen. like Balls, flashlight, so on..

 Respond  
Blitzjager   -  Oct 11, 2008

Fun. Kept doing it until I could see a person or something lol

 Respond  
BlueThen   -  Oct 11, 2008

Then +Like it, Kirby. :P

 Respond  
Kirby   -  Oct 11, 2008

/ME LIKES

 Respond  
xplo   -  Oct 11, 2008

this is the most useless (a.k.a. Cool) thing i have ever seen on hawkee ;p

 Respond  
BlueThen   -  Oct 11, 2008

Fixed the menu bug.

I did come up with a concept for fireworks at one point, just never made it. Maybe next time, when/if I ever get to it.

 Respond  
^Neptune   -  Oct 11, 2008

Awesome.

Hey, just a future idea inspired by this one... fireworks? :D
You could have big ones, ones that whizz around before exploding, ones that make the background of the picwin flash, etc!

 Respond  
BlueThen   -  Oct 11, 2008

Well, I just fixed the drawcopy bug, for when you close it after using reset. I'll get to the menu bug.

 Respond  
^Neptune   -  Oct 11, 2008
* /drawcopy: invalid window (line 69, script5.mrc)
* /drawcopy: invalid window (line 69, script5.mrc)

This just randomly pops up sometimes, not sure why.

Line 69:

    drawcopy -m @tree.buf 0 0 800 800 @tree 0 0 400 400

Also, if you have it open and select the Tree from the menu again while it's still open, you get it maximized on your screen with no way to get rid of it except ALT+Z

 Respond  
BlueThen   -  Oct 11, 2008

Well, the algorithms and stuff were the easy part, but the majority of my time scripting this involved adjusting several stuff. I might make a separate dialog later, so people can adjust it to their own liking.

 Respond  
^Neptune   -  Oct 11, 2008

It'd be nice if it grew out of one particular area, like a pot as EL said. :P

Doesn't realy look like a tree, looks like a randomized scribble :P

Otherwise very good work

 Respond  
BlueThen   -  Oct 11, 2008

Thank you, it's one of the great things about $rand

 Respond  
rhasttaff   -  Oct 11, 2008

lol very nice brother ;)
every time is a different draw very interessant
good work ;)

Jah Bless´´´

 Respond  
BlueThen   -  Oct 11, 2008

Thanks, also, forgot to say... Press the Space bar to reset it.

 Respond  
EL   -  Oct 11, 2008

Make it a pot plant BT;p.Nice job btw i missed your picwins after all these sad ass codes that have been bein posted=\

 Respond  
Are you sure you want to unfollow this person?
Are you sure you want to delete this?
Click "Unsubscribe" to stop receiving notices pertaining to this post.
Click "Subscribe" to resume notices pertaining to this post.