Donate to us!
Become the change you seek in the world. - Gandhi
Friday, May 25, 2018
 Need Help?
Members Online
Total Online: 80
Guests Online: 77
Members Online: 3

Registered Members: 105282
Newest Member: digitaldopefiend
Latest Articles
View Thread

HellBound Hackers | Computer General | Programming

Page 3 of 3 < 1 2 3

RE: Source code


Your avatar

Joined: 01.01.70
Posted on 21-12-05 21:06
Heres a drawing application I made in Flash ActionScript 2.0, purely in code (just because I can):

#include ""
(_root.createEmptyMovieClip("menu", 1)).defaultSettings();
menu.drawRect([0, 0, 550, 400]);
menu.drawRoundedRect([25, 25, 525, 325], 25);
menu.beginFill(0x666666, 100);
menu.drawRoundedRect([25, 335, 525, 390], 25);
var col:Array = [0x000000, 0x0000CC, 0x0000FF, 0x000099, 0x00CC00, 0x00CCCC, 0x00CCFF, 0x00CC99, 0x00FF00, 0x00FFCC, 0x00FFFF, 0x00FF99, 0x009900, 0x0099CC, 0x0099FF, 0x009999, 0xCC0000, 0xCC00CC, 0xCC00FF, 0xCC0099, 0xCCCC00, 0xCCCCCC, 0xCCCCFF, 0xCCCC99, 0xCCFF00, 0xCCFFCC, 0xCCFFFF, 0xCCFF99, 0xCC9900, 0xCC99CC, 0xCC99FF, 0xCC9999, 0xFF0000, 0xFF00CC, 0xFF00FF, 0xFF0099, 0xFFCC00, 0xFFCCCC, 0xFFCCFF, 0xFFCC99, 0xFFFF00, 0xFFFFCC, 0xFFFFFF, 0xFFFF99, 0xFF9900, 0xFF99CC, 0xFF99FF, 0xFF9999, 0x990000, 0x9900CC, 0x9900FF, 0x990099, 0x99CC00, 0x99CCCC, 0x99CCFF, 0x99CC99, 0x99FF00, 0x99FFCC, 0x99FFFF, 0x99FF99, 0x999900, 0x9999CC, 0x9999FF, 0x999999];
for (a=0; a<col.length/2; a++) {
   for (b=0; b<2; b++) {
      if (b == 1 && a == 0) {
         (_root.createEmptyMovieClip("col"+a+"_"+b, _root.getNextHighestDepth())).beginFill(0xFFFFFF, 100);
      } else {
         (_root.createEmptyMovieClip("col"+a+"_"+b, _root.getNextHighestDepth())).beginFill(col[a*(b == 0 ? 1 : 2)], 100);
      _root["col"+a+"_"+b].drawRoundedRect([40+(14*a), 347+(14*b), 50+(14*a), 357+(14*b)], 5);
      _root["col"+a+"_"+b].cola = ((b == 1 && a == 0) ? 0xFFFFFF : col[a*(b == 0 ? 1 : 2)]);
      _root["col"+a+"_"+b]._x += 14;
      _root["col"+a+"_"+b]._y += 4;
      _root["col"+a+"_"+b].onPress = function() {
         _root.lineStyle(1, this.cola, 100);
onMouseDown = function () {
   if (_xmouse>30 && _xmouse<520 && _ymouse>30 && _ymouse<320) {
      moveTo(_xmouse, _ymouse);
      np = setInterval(function () {
         lineTo(_xmouse, _ymouse);
      }, 10);
onMouseUp = function () {

You also need an external file called, and thanks to my mate dELta for the oval function..

MovieClip.prototype.defaultTextbox = function(inst:String, X:Number, Y:Number):Void  {
   var temp:TextField = this.createTextField(inst, this.getNextHighestDepth, X, Y, 100, 30);
   temp.type = "input";
   temp.selectable = false;
MovieClip.prototype.drawOval = function(X:Number, Y:Number, xr:Number, yr:Number):Void  {
   yr == undefined ? yr=xr : 0;
   var ctrlRadius:Number = xr/0.92387953251128675611953741891446;
   var ctrlRadius2:Number = yr/0.92387953251128675611953741891446;
   this.moveTo(X+xr, Y);
   var angle:Number = 0;
   for (var i:Number = 0; i<8; i++) {
      angle += 0.78539816339744830961566084581988;
      var angleMid:Number = angle-0.39269908169872415483042290994;
      var cx:Number = X+Math.cos(angleMid)*(ctrlRadius);
      var cy:Number = Y+Math.sin(angleMid)*(ctrlRadius2);
      var px:Number = X+Math.cos(angle)*xr;
      var py:Number = Y+Math.sin(angle)*yr;
      this.curveTo(cx, cy, px, py);
MovieClip.prototype.defaultSettings = function():Void  {
   this.lineStyle(2, 0x000000, 100);
   this.beginFill(0x000000, 100);
MovieClip.prototype.drawRect = function(xy:Array):Void  {
   this.moveTo(xy[0], xy[1]);
   this.lineTo(xy[2], xy[1]);
   this.lineTo(xy[2], xy[3]);
   this.lineTo(xy[0], xy[3]);
   this.lineTo(xy[0], xy[1]);
MovieClip.prototype.drawRoundedRect = function(xy:Array, ang:Number):Void  {
   this.moveTo(xy[0], xy[1]+ang);
   this.curveTo(xy[0], xy[1], xy[0]+ang, xy[1]);
   this.lineTo(xy[2]-ang, xy[1]);
   this.curveTo(xy[2], xy[1], xy[2], xy[1]+ang);
   this.lineTo(xy[2], xy[3]-ang);
   this.curveTo(xy[2], xy[3], xy[2]-ang, xy[3]);
   this.lineTo(xy[0]+ang, xy[3]);
   this.curveTo(xy[0], xy[3], xy[0], xy[3]-ang);
   this.lineTo(xy[0], xy[1]+ang);
A collaberation of functions that make drawing using the
MovieClip API a lot easier, most commands will be prototypes
of the MovieClip class and some will be taken from the
ActionScript 3.0 Shape API (which has taken over from the
MovieClip API).

I doubt many people have Flash here but I thought I'd post them anyway :P Well heres a simple calculator I made in C++. It's pretty crap but it's the first thing I made so I was pretty proud of it at the time:

#include <iostream>
#include <fstream>
using namespace std;
long fact(long num){
     //this function returns the Factorial of the given number
     int temp = num;
     for(int a=1;a<num;a++){
     return temp;
    //First thing you do, declare the variables
    int a, b, c, type;
    ofstream myfile;
    const char* types[5] = {"add", "subtract", "divide", "multiply", "get factorial"};
    //This is the introduction text
    cout<<"Simple calculator by -liam-\n\n";
    cout<<"Choose mode: \n";
    //These are the options
    cout<<"1 to add\n";
    cout<<"2 to subtract\n";
    cout<<"3 to divide\n";
    cout<<"4 to multiply\n";
    cout<<"5 to get factorial\n";
    cout<<"6 to see info\n\n";
    //'choose' is the name of a label, so I can restart the program from this point
    //Tell the person to choose an option
    cout<<"Press the relevant key then press enter: ";
    //The following is all the adding, subtracting, etc.
    cout<<"You chose to "<<types[type-1]<<". Type a number: ";
    cout<<"\nType another number: ";
    int ans;
    ans = a+b;
    cout<<endl<<a<<" + "<<b<<" = "<<ans<<endl;
    ans = a-b;
    cout<<endl<<a<<" - "<<b<<" = "<<ans<<endl;
    ans = a/b;
    cout<<endl<<a<<" / "<<b<<" = "<<ans<<endl;
    ans = a*b;
    cout<<endl<<a<<" * "<<b<<" = "<<a*b<<endl;
    ans = fact(a);
    cout<<endl<<a<<"! = "<<ans<<endl<<endl;
    myfile<<a<<" "<<types[type-1]<<" "<<b<<" = "<<ans;
    cout<<"1 adds two numbers; \n2 subtracts two numbers;\n";
    cout<<"3 divides two numbers;\n4 multiplys two numbers;\n";
    cout<<"5 will find the factorial of a number.\n";
    goto choose;
    goto choose;


RE: Source code


Your avatar

Joined: 01.01.70
Posted on 21-12-05 22:25
Just in case anyone is remotely interested, here is a little applescript (obviously, this is mac only!) that I like to call, "Snoop". It makes a file or folder completely invisible, although the system still behaves as if it's till there (and indeed it is). All it does is ask you to tell it the path to your file to hide and then inserts whatever you told it into a pretty nifty shell script. I also added that little bit about AppleScript's text item delimeters to try and handle files with spaces in their names, but it failed seeing as some people use bash terminal and some don't.

tell application "Finder"
   set choose to display dialog "Welcome to Snoop by Pepe. What would you like to do?" buttons {"Hide", "Reveal"} with icon 1
   if button returned of choose is "Hide" then
      set hidefile to display dialog "What would you like to hide?" default answer "/Users/YOURUSERNAMEHERE/Desktop/FILE TO HIDE" with icon 1
      set theScript to text returned of hidefile
      set ASTID to AppleScript's text item delimiters
      set AppleScript's text item delimiters to {" "}
      set theScript to every text item of theScript
      set AppleScript's text item delimiters to {"/ "}
      set theScript to theScript as text
      set AppleScript's text item delimiters to ASTID
      tell application "Terminal"
         do shell script "/Developer/Tools/SetFile -a V " & theScript
         do shell script "/bin/kill -1 `ps auxc | grep Finder | awk '{print $2}'`"
      end tell
      display dialog "You have hidden " & text returned of hidefile & ". Snoop is writing a file to your desktop, reminding you of which files you have hidden. It is suggested that you keep this log so that you do not lose your data." with icon 2
      set Filename to "Snoop hidden files log"
      set this_data to (text returned of hidefile) & return as string
      set target_file to ((path to desktop folder as Unicode text) & Filename)
      set append_data to true       
      try          set the target_file to the target_file as text
         set the open_target_file to open for access file target_file with write permission
         if append_data is false then set eof of the open_target_file to 0
         write this_data to the open_target_file starting at eof
         close access the open_target_file
      on error
            close access file target_file
         end try
      end try
      display dialog "File succcesfully hidden!" with icon 1
      set showfile to display dialog "Which file would you like to reveal?" default answer "/Users/YOURUSERNAMEHERE/Desktop/FILE TO SHOW" with icon 1
      tell application "Terminal"
         do shell script "/Developer/Tools/SetFile -a v " & text returned of showfile
         do shell script "/bin/kill -1 `ps auxc | grep Finder | awk '{print $2}'`"
      end tell
      display dialog "File succcesfully revealed!" with icon 1
   end if
end tell

I'm happy to answer any questions.

Edited by on 21-12-05 22:26
Page 3 of 3 < 1 2 3