Top

Sphere


mIRC Code
+ 1 likes
Please Register to submit score.
Bookmark and Share
Average Score  8.0 (of 2 scores)
Date Added  May 16, 2009
Last Updated  May 16, 2009
Tags  algorithm  bluethen  etc  particle  sphere 

Description

I might release some documentation explaining all my algorithms. Don't know if anyone'd be interested though.

Grab the Code

;Sphere
;Made by BlueThen on May 16, 2009
;To install, paste this script in your Remotes (Alt + R)
;Then type /sphere or right click the channel or status and click "Sphere".
menu channel,status {
  Sphere: sphere
}
alias sphere {
  window -paoCzdk0 +tnbL @Sphere -1 -1 400 400
  set %sphere.a 0
  set %sphere.a2 0
  %sphere.t = 1
  %sphere.x = 15
  while (%sphere.x) {
    %sphere.y = 15
    while (%sphere.y) {
      hadd -m X %sphere.t %sphere.x
      hadd -m Y %sphere.t %sphere.y
      inc %sphere.t
      dec %sphere.y 
    }
    dec %sphere.x
  }
  set %sphere.tok tokenize 32 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 $&
    31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46  47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 $&
    67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97  98 99 100  $&
    101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 $&
    128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 $&
    156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 $&
    183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 $&
    211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 
  sphere.frame
}
 
alias -l sphere.frame {
  if ($window(@sphere)) {
    clear -n @sphere
    drawfill -n @sphere 1 1 1 1
    %sphere.tok
    scon -r .!drawdot -nr @sphere $!rgb( $!calc( 143+( $* /2)), $!calc( 143+( $* /2)), $!calc(143+ ( $* /2))) 1 $!sphere.iso( $!calc( (7.5- $!hget(Y, $* ))*15* $!cos( $!calc( $!hget(X, $* )*24+ %sphere.a )).deg), $!calc( 75* $!sin( $!calc( $!hget(Y, $* )*24)).deg), $!calc( (7.5- $!hget(Y, $* ))*15* $!sin( $!calc( $!hget(X, $* )*24+ %sphere.a )).deg)) 
    set %sphere.a $calc(100 * $sin(%sphere.a2).deg)
    inc %sphere.a2 4
    drawline @sphere
    .timer 1 0 sphere.frame
  }
  else unset %sphere.*
}
alias -l sphere.iso return $calc(($1 - $3)*0.866+200) $calc(($1 + $3)*0.5- $2 +200)

Comments

  (16)  RSS
Kirby
Comments: 480
 
mIRC Snippet:  Sphere
Posted on May 16, 2009 7:31 pm
Hey BlueThen. Another cool snippet.
I've recently taken a brief look at trigonometry and I've gotten down some of the basics (cosine, sine, tangent, and their opposites); and yeah, it's quite interesting.
However, I haven't actually started making picture window animations/games yet, but they seem to be a fine challenge. :d
And to answer your question, I think it'd be a good idea to release your documentation of algorithms.
Prelude
Comments: 98
 
mIRC Snippet:  Sphere
Posted on May 16, 2009 8:21 pm
Pretty neat BT, Not sure if i could even read your math skillz but you should post it for the hell of it.
SumWon
Comments: 18
 
mIRC Snippet:  Sphere
Posted on May 17, 2009 2:57 am
"I might release some documentation explaining all my algorithms. Don't know if anyone'd be interested though."

I surely would be.
WorldDMT
Comments: 173
 
mIRC Snippet:  Sphere
Posted on May 17, 2009 8:12 am
hi

for %sphere.a, and %sphere.a2

no need to set it 0 the "inc", and "set" command into alias sphere.frame will set it, and wen u close the windows, that will unset so u can remove it

for %sphere.t,%sphere.x, and %sphere.y set it local

var %sphere.t 1,%sphere.x 15,%sphere.y 15

for %sphere.tok u can do this

Code:
set %sphere.tok tokenize 32 $regsubex($str(.,225),/./g,\n $+ $chr(32))


and no need to set it, put it directly into the alias sphere.frame

if u want u can use one comand for not use 2 like "inc" "dec" u can use "var"

so

Code:
inc %sphere.t
dec %sphere.y

can be one commande also like this

var %sphere.t %sphere.t + 1,%sphere.y %sphere.y - 1



and finaly dont forget to remove hash tables hfree x/y

so your code can be like this

Code:
menu channel,status {
  Sphere:sphere
}
alias sphere {
  window -paoCzdk0 +tnbL @Sphere -1 -1 400 400
  var %sphere.t 1,%sphere.x 15,%sphere.y 15
  while %sphere.x {
    while %sphere.y {
      hadd -m X %sphere.t %sphere.x
      hadd -m Y %sphere.t %sphere.y
      var %sphere.t %sphere.t + 1,%sphere.y %sphere.y - 1
    }
    dec %sphere.x
  }
  sphere.frame
}
alias -l sphere.frame {
  if ($window(@sphere)) {
    clear -n @sphere
    drawfill -n @sphere 1 1 1 1
    tokenize 32 $regsubex($str(.,225),/./g,\n $+ $chr(32))
    scon -r .!drawdot -nr @sphere $!rgb( $!calc( 143+( $* /2)), $!calc( 143+( $* /2)), $!calc(143+ ( $* /2))) 1 $!sphere.iso( $!calc( (7.5- $!hget(Y, $* ))*15* $!cos( $!calc( $!hget(X, $* )*24+ %sphere.a )).deg), $!calc( 75* $!sin( $!calc( $!hget(Y, $* )*24)).deg), $!calc( (7.5- $!hget(Y, $* ))*15* $!sin( $!calc( $!hget(X, $* )*24+ %sphere.a )).deg))
    set %sphere.a $calc(100 * $sin(%sphere.a2).deg)
    inc %sphere.a2 4
    drawline @sphere
    .timer 1 0 sphere.frame
  }
  else {
    unset %sphere.a*
    hfree x
    hfree y
  }
}
alias -l sphere.iso return $calc(($1 - $3)*0.866+200) $calc(($1 + $3)*0.5- $2 +200)
^Neptune
Comments: 629
 
mIRC Snippet:  Sphere
Posted on May 17, 2009 10:19 am
Someone correcting BT's codes? Jesus christ.
FordLawnmower
Comments: 620
 
mIRC Snippet:  Sphere
Posted on May 17, 2009 11:46 am
He's just picking at it with personal preferences, although I agree that you have to free the hashtables.
These 9 mile long workshops do nothing more than take away from the hard work that the actual scripter did. WorldDMT should stop tooting his own useless horn and post a script!!
BlueThen
Comments: 395
 
mIRC Snippet:  Sphere
Posted on May 17, 2009 1:24 pm
Thanks for the feedback. I'll look into it, WorldDMT.
JohnSmith
Comments: 15
 
mIRC Snippet:  Sphere
Posted on May 17, 2009 2:18 pm
FordLawnmower: WorldDMT has posted a script. http://www.hawkee.com/snippet/6149/
tv3636
Comments: 91
 
mIRC Snippet:  Sphere
Posted on May 17, 2009 2:30 pm
Quote:
inc %sphere.t
dec %sphere.y

can be one commande also like this

var %sphere.t %sphere.t + 1,%sphere.y %sphere.y - 1

How is that better in any way? The computer is still performing the same processes, you're just saving a line. You could also just do inc %sphere.t | dec %sphere.y but it doesn't matter at all.
BlueThen
Comments: 395
 
mIRC Snippet:  Sphere
Posted on May 17, 2009 2:47 pm
I found that pipes (|) can slow down your script drastically.
FordLawnmower
Comments: 620
 
mIRC Snippet:  Sphere
Posted on May 17, 2009 2:52 pm
I hate pipes. Thanks John Smith. That must have taken all of 5 minutes ;/
tv3636
Comments: 91
 
mIRC Snippet:  Sphere
Posted on May 17, 2009 3:01 pm
Alright, I wasn't aware they actually slowed things down. Regardless, having the var setting on one line versus two should not make a difference, should it?
WorldDMT
Comments: 173
 
mIRC Snippet:  Sphere
Posted on May 18, 2009 4:29 am
@tv3636
Quote:
inc %sphere.t
dec %sphere.y

can be one commande also like this

var %sphere.t %sphere.t + 1,%sphere.y %sphere.y - 1


here we have one commande not 2 is a little faster wen i changed all that thing u can see the difference

the time of execution for his code is between 172 - 187 ticks or mine is 140 - 156

is faster :)

@FordLawnmower:
Quote:
WorldDMT should stop tooting his own useless horn and post a script


do u see any thing not good about my comments?
knoeki
Comments: 142
 
mIRC Snippet:  Sphere
Posted on Jun 28, 2009 2:51 pm
Quote:
Quote:
WorldDMT should stop tooting his own useless horn and post a script



do u see any thing not good about my comments?


yes. for example, constantly telling people how to do it differently. Seriously, even if you know it better, there's no need to keep telling people HOW to do it, you can also just give some tips or shut up, whatever suits you best.

Right now you just come across to me as a wiseass with an obession of proving his superiority.
BlueThen
Comments: 395
 
mIRC Snippet:  Sphere
Posted on Jun 29, 2009 3:57 pm
Hey. Lets not argue. I appreciate any feedback, especially WorldDMT\'s. Sure he sounds like a douche when he talks about it, but it\'s very constructive, if anything.
WorldDMT
Comments: 173
 
mIRC Snippet:  Sphere
Posted on Jun 30, 2009 2:09 am
@knoeki: i dont speak english verry well but look at my comments


Quote:
if u want u can use one comand for not use 2 like "inc" "dec" u can use "var"


so i told "if u want" and i never tell people how to do but that can learn u more
i was like u and i learn where is the problem?

anyway i'll comment always your post and if u wanna do like FordLawnmower no problem but read it before cz that can learn u somme thing and that's not bad :)

Commenting Options

Register or Login to Hawkee.com or use your Facebook or Twitter account by clicking the corresponding button below.

  

Bottom