Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Topics - BlakPilar

Pages: 1 2 [3] 4
31
TI-BASIC / Convert any base algorithm help
« on: September 12, 2011, 07:42:37 pm »
Ok, first off, PLEASE don't give me another routine (I am aware that Weregoose (I believe) has a super-optimized base converter algorithm), I just want to see if the one I'm trying will work.

Now, in theory (or at least through my way of thinking), this routine should work, but I get an error for anything other than hexadecimal. Here's all of the code for it:
Code: [Select]
"0123456789ABCDEFG→Str2
length(Str2→L

Input "DEC: ",D
"_→Str1

If 0>D or not(D
"0→Str1

While D>0
sub(Str2,L(fPart(D/L))+1,1)+Str1→Str1
iPart(D/L→D
End

Disp Str1
However, I keep getting errors during the first run-through on the sub command. I've manually checked all the variables' values (using 50 as my test value) and the very first letter should be G, but I keep getting a domain error with the cursor scrolling to the closing parenthesis of the sub command.

Any ideas? ???

32
Computer Programming / [Tutorial] Snow in XNA 4.0 (C#)
« on: September 10, 2011, 04:32:06 pm »
I'm writing a game in XNA 4.0 (my first huge computer game for both XNA and C#), and one of the things I wanted to do for the main menu was add a snow effect because the game is called Tundra and a tundra is a cold and snowy place and, well, I think you get the idea. I thought it looked pretty cool when it was done, and figured maybe the function I created could be used for something else by somebody else, so here it is!

First, for ease, what I did was create two public properties to be equal to the width and height of the game window. Basically, it looked like this:
Code: [Select]
private int w, h;
public int Width { get { return this.w; } }
public int Height { get { return this.h; } }

protected override void Initialize()
{
    this.w = this.Window.ClientBounds.Width;
    this.h = this.Window.ClientBounds.Height;

    //There's more code in here, just not needed for this tutorial
}
Just try to remember to not assign to h or w ;)

After that, I made some variables all dealing with the snow. I made them private because I'm more than likely not going to use them specifically outside of my method to draw the snow, but you can feel free to make them public.
Code: [Select]
private Point[] snow = new Point[225];  //You can increase/decrease this number depending on the density you want
private bool isSnowing = false;           //I only set this to true (so far) in the main menu
private Texture2D snowTexture;           //Our texture for each snow particle. I'll attach mine, though it's very simple
private Point quitPoint;                       //The point at which we need to recycle the snow particle
private Point startPoint;                     //The point where the snow particle gets recycled to
private Random random;                    //Will be used for generating new random numbers
For quitPoint and startPoint, we'll only be using their Y-coordinate.

Now, go to the LoadContent method. Here we'll load the snow's texture as well as the quit and start points. If you do these points in Initialize, you'll get a NullReference error because XNA calls LoadContent after Initialize (in case you didn't know).
Code: [Select]
protected override void LoadContent()
{
    //Load our texture. I placed it in a folder called "Textures," if you don't put it in any folder, don't use "Textures\\"
    //or if you use a different folder, replaces Textures with its name.
    this.snowTexture = this.Content.Load<Texture2D>("Textures\\snow");

    //Set the snow's quit point. It's the bottom of the screen plus the texture's height so it looks like the snow goes completely off screen
    this.quitPoint = new Point(0,
        this.Height + this.snowTexture.Height);

    //Set the snow's start point. It's the top of the screen minus the texture's height so it looks like it comes from somewhere, rather than appearing
    this.startPoint = new Point(0,
        0 - this.snowTexture.Height);
}

If you want to be exactly like me, somewhere in your code, make a method called DrawSnow that doesn't take any parameters. We'll come back to that in a second. Head on over to your draw function and call DrawSnow between where you begin and end the sprite batch. Also, change the clear color from CornFlowerBlue to White.
Spoiler For Clarification:
Code: [Select]
public void DrawSnow()
{
}

protected override void Draw()
{
    GraphicsDevice.Clear(Color.White);

    this.spriteBatch.Begin();

    this.DrawSnow();

    base.Draw(gameTime);

    //I was told sometime that putting this after base.Draw(...) was better
    this.spriteBatch.End();
}

Now for the meat and potatoes of this tutorial!

I'm just going to copy and paste my code, but I'm adding comments that will tell you what's going on.
Code: [Select]
public void DrawSnow()
{
    //If it's not supposed to be snowing, exit
    if (!isSnowing)
        return;

    //This will be used as the index within our snow array
    int i;

    //NOTE: The following conditional is not exactly the best "initializer."
    //If snow has not been initialized
    if (this.snow[0] == new Point(0, 0))
    {
        //Make the random a new random
        this.random = new Random();

        //For every snow particle within our snow array,
        for (i = 0; i < this.snow.Length; i++)
            //Give it a new, random x and y. This will give the illusion that it was already snowing
            //and won't cluster the particles
            this.snow[i] = new Point(
                (random.Next(0, (this.Width - this.snowTexture.Width))),
                (random.Next(0, (this.Height))));
    }

    //Make the random a new random (again, if just starting)
    this.random = new Random();

    //Go back to the beginning of the snow array
    i = 0;

    //Begin displaying the snow
    foreach (Point snowPnt in this.snow)
    {
        //Get the exact rectangle for the snow particle
        Rectangle snowParticle = new Rectangle(
            snowPnt.X, snowPnt.Y, this.snowTexture.Width, this.snowTexture.Height);

        //Draw the snow particle (change white if you want any kind of tinting)
        this.spriteBatch.Draw(this.snowTexture, snowParticle, Color.White);

        //Make the current particle go down, but randomize it for a staggering snow
        this.snow[i].Y += random.Next(0, 5);

        //Make sure the point's location is not below quit point's
        if (this.snow[i].Y >= this.quitPoint.Y)
            //If it is, give it a random X value, and the starting point variable's Y value
            this.snow[i] = new Point(
                (random.Next(0, (this.Width - this.snowTexture.Width))),
                this.startPoint.Y);

        //Increment our position in the array ("go to the next snow particle")
        i++;
    }
}

Voila! You now have snow in your program! If you need something explained more, feel free to ask. If you have imporvements, say so and I'll add them. If you want to use this somewhere (not necessarily in C#/XNA), feel free to go ahead and do so! In this, I only change the Y position of the snow particles. If you want to do something with the X to make it more realistic, go right ahead.

I've attached a gif of what it looks like in Tundra ;) but thanks for your time :)

P.S. - If this is in the wrong category, please move it to the appropriate one. I've had problems with that in the past lol

33
Other / JDK 1.6u27 / Android SDK not installing on Win7 64-bit?
« on: September 04, 2011, 08:01:31 pm »
I've downloaded and "installed" the JDK 1.6 update 27 at least 3 times now, but the Android SDK isn't recognizing that I've installed it for some reason. When I get the version from the command prompt it only shows that I have the JRE installed (the correct version), but idk if it shows anything for the JDK.

Any ideas? ???

34
General Discussion / For gothic metal lovers/likers
« on: August 20, 2011, 09:41:18 pm »
So I'm not really a great fan of the gothic subgenre myself (I'm more into the deathcore/metalcore stuff if you look at my sig), but evidently I felt something click with this band (probably the vocals). I didn't remember I had them until just now whilst cleaning out my 3,000-some songs library.


Spoiler For Lyrics (from SongLyrics):
(Again... Again you try to find me
You seek the one not willing to be found.)
Pyramid God
(Unlike the places you have been,
I am not confined by lines.)
 
Pyramid God
(I am the dreamer of this realm
(GOD) But not the dream inside)
Pyramid God
(I am the head outside the dream
(GOD) I am the headless mind!)

(Are you... Are you a breath of mine?
You cross my gates, the gates of Space and Time.)
 
"Pyramid God, am I the user of the gates?
I live a triangle life"
 
Pyramid God
(I am the dreamer of this realm
(GOD) But not the dream inside.)
 
Pyramid God
(I am the head outside the dream
(GOD) I am the headless mind!)
 
(Built me a monument, Nem Age conspirators.
Expand my theories to a world without end.)
The Pyramid God is watching...
(Built me a monument, Nem Age conspirators.
Expand my theories to a world without end.)

35
Miscellaneous / Do you know what Duplo blocks are?
« on: August 20, 2011, 09:23:46 pm »
Hmm? Do ya?

36
Humour and Jokes / Stormtrooper parodies
« on: August 18, 2011, 10:36:46 pm »
I've been searching for these two videos for the last two years... Soooo glad I found them again! Take the 14 or so minutes and watch them.


37
Computer Projects and Ideas / The dawn of a new OOPL
« on: August 14, 2011, 10:57:19 am »
SEE THIS POST
Spoiler For OP:

In case you haven't looked (or even glanced) at my signature, I'm writing an OOPL called Zenon. :D (In case you don't know what that means, it stands for Object-Oriented Programming Language.)

My only problem is: I'm terrible at coming up with syntax because I have no creativity :( The syntax I have right now looks cool, but it's impractical. It requires more unnecessary typing than I'd like.

This language will be .NET-based, so anything you can do in C# or VB, you'll be able to do in this. This includes designing forms, creating console-based applications, and probably libraries (.dll's) for use with other, non-Zenon programs. My request to you, the Omnimaga community, is to help construct a syntax for this language.

I guess the only thing I want you to keep in mind when suggesting syntax and whatnot is to try to make it fun to write in. Something you'd like to make a program or two with. The language can be simple, complex, or moderate, it can be completely original or it can combine elements of other languages together. But please, this will not be an esoteric language ;)

Syntax last updated: 4:24pm EST (GMT-5) on 19 Aug 2011.
Change with block comments and methods, etc.!!

Spoiler For Current syntax:

* - Indicates a change
+ - Indicates an addition
# - Indicates a removal
Since last edit, that is.
--
As in many languages, a semi-colon will mark the end-of-line.
--
Strings will be like every other programming language; beginning and ending with a (double) quote.
--
*Block comments will be [[ comment ]], single line comments will be "//comment"
--
Modifiers are the same as any .NET language. These include "public," "private," "sealed," and "abstract". However, "public" will be "global," "private" will be "internal," "sealed" will be "closed," and "abstract" will be "open".
--
Threads will be a built-in type for easier access. (yay)
--
#Moved arrays and matrices so they have their own mini-topic
--
Instead of using "." to access the methods of a variable, the colon (":") will be used. I.e. instead of "<var>.<method>;", it will be "<var>:<method>;"
--
Accessing the current application/class will be "current" instead of "this" or "Me".
--
Inheritance will be implemented.
--
"parent" will be used instead of "base" (like in C# or <insert other language that uses "base">) or "super" (like Java).
--
"break" (from C#, not sure on its equivalent in Java, etc.) will be "exit"
--
"quit" will be a general command to exit the program, unless in an infinite loop :P.
--
+Preprocessor directives will only be in the main file and will be denoted by '@'.

VARIABLES
Will be defined by "<type> <name> [= <value>];"
-Here is a list of current types (layout is "<type> : <declaration name> : <default value>")
  -string   : str  : ""
  -integer  : int  : 0
  -boolean  : bool : false
  -byte     : byte : 00

CONDITIONALS
Will be accessed by
 "if (<condition>) {
   <code>
  }
  elseif (<condition>) {
    <code>
  }
  else {
    <code>
  }"
You will also have the ability to use switch/case statements that will be used in a similar fashion.

METHODS / FUNCTIONS
Methods, since they don't return anything, are sub-procedures and therefore will be accessed by
 "<modifiers> sub <method name> ([<arguments>]) {
    <code>
  }"
Functions will be similar, replacing "sub" with their return type.
 "<modifiers> <type> <function name> ([<arguments>]) {
    <code>
    return <type>;
  }"

LOOPS
Will support 4 types of loops:
-While
 "do {
    <code to be executed until condition is false>
  } while (<condition>);"
-Until
 "do {
    <code to be executed until condition is true>
  } until (<condition>);"
---Both of the above loops can have the "test" (the "while" or "until" part) either before "do", or after the closing brackets like in the example.
-For
 "for (<int>[ = beginning], <end>[, increment]) {
    <code>
  }"
-For Each
 "foreach (<type> <var> in <collection [of type]>) {
    <code>
  }"
Thanks to calcdude for the idea of testing before and after.

CLASSES
Will be implemented in the same way that most languages (at least the ones I know) implement them.
 "<class name> <class var name> = new <class name>;"

ENUMS
An enum, in case you don't know what it is, is basically a group of numbers. However, in Zenon, they can be a group of anything. (If that can't be done, then a new group type will be added called Group)
-Declared:
 "<modifiers> enum <name> {
    <name> = <number>,
    <name2> = <number>,
    etc.
  }"
-Accessed:
 "<enum> <var name> = <enum>:<enum child>;"

+ARRAYS/MATRICES
As an example, here are declarations of a string array, matrix, and collections that have more that 2 dimensions:
-Array:  str# hello = new str#[0][1][2];
-Matrix: str# hello = new str#[[0][1][2],[3][4][5]];
-Multi:  str# hello = new str#[[0][1][2],[3][4][5],[6][7][8]];
Or, for non-specific declarations, one can do
-Array:  str# inf = new str#[];
-Matrix: str# inf = new str#[,];
-Multi:  str# inf = new str#[,,];


38
Computer Programming / Syntax highlighting RTB in C#
« on: August 13, 2011, 08:58:24 pm »
I'm working on an IDE and the first thing I want to tackle/complete is the text editor. Right now I'm working on the syntax highlighting part of it. Strings highlight perfectly, and so do keywords. However, the part where it un-highlights keywords that have been partially deleted seems to not want to cooperate.

Here's my code, for anyone who thinks they can help, or just wants to take a peek at it ;)
(I comment a lot, so it should be fairly easy to understand)
Spoiler For Code:
Code: [Select]
    //Initiate vars
    string[] lines = this.Lines;
    int pos = 0;
    int cpos = this.SelectionStart;
    int line = this.GetLineFromCharIndex(cpos);

    //Let's see if there are even any keywords in the line.
    //If not, we'll exit
    bool cont = false;
    foreach (string kw in rsrvdWrds)
        if (lines[line].Contains(kw))
            cont = true;

    //If the current line doesn't contain any words,
    if (!cont)
        return;     //Exit

    //Get the exact beginning char index of the line
    for (int i = 0; i < line; i++)
        //+1 because of \n
        pos += lines[i].Length + 1;

    //Now pos is the index of the first char on the current line
    //Reset line colors (THESE ARE THE FOUR LINES THAT *SHOULD* RESET THE LINE COLOR)
    this.SelectionStart = pos;                  //Go to beginning of line
    this.SelectionLength = lines[line].Length;  //Select the line
    this.SelectionColor = Color.Black;          //Turn it black
    this.SelectionLength = 0;                   //Deselect the line

    //For each match of keyword in the current line
    foreach (Match kw in reservedWords.Matches(lines[line])) {

        this.SelectionStart = pos + kw.Index;
        this.SelectionLength = kw.Length;
        this.SelectionColor = Color.Blue;

    }

    //Highlight any strings that might be in the line's string
    this.HighlightString(line);

    //Resume current position
    this.SelectionLength = 0;
    this.SelectionStart = cpos;
    this.SelectionColor = Color.Black;
Oh, by the way, this is an extended control. By that, I mean it's a control that inherits from the RichTextBox. That's why it says "this" instead of "rtbCode" or something like that.

39
Miscellaneous / Types of Cell Phones
« on: August 10, 2011, 12:43:54 am »
Which type of cell phone do you use? I.e., Windows Phone, Droid, iPhone, Blackberry, other, etc.

I mainly want to know to see how many Windows Phone users there are on here. This can help for anyone who develops for it, so we can help each other debug and whatnot (same for Droid, iPhone, etc.). I'm looking into learning XNA so I can make a game for Windows Phone (7), because I'm hopefully getting one soon ;D

40
Other / Web Hosting Questions
« on: August 03, 2011, 05:33:55 pm »
 I just have some questions about web hosting (in case you couldn't tell by the title ;)).
  • If a host supports MySQL, does that necessarily mean they support ASPX as well?
  • If the host says "unlimited domains," does that mean one could have hai1.com, hai2.com, etc. and hosting for each domain?
  • Who's the best hoster for having both a personal and a semi-public* site? (FatCow, iPage, HostGator,etc.)

*Two sites (at least). The personal would just be for family and friends, and the semi-public would be advertised.

41
Computer Programming / 8xp File Structure
« on: July 26, 2011, 04:52:19 pm »
I have a document (I can't remember where I got it from) and I was just wondering if it is 100% accurate. If it is, can someone explain the checksum? Thanks.

Code: [Select]
All values are in decimal.

8XP File:
(1-11)Header (11 bytes): 42,42,84,73,56,51,70,42,26,10,0
(12-52)Comment (42 bytes): 42 bytes of ASCII, if the comment is <42 bytes then fill the rest of the space with 0s
(53)Comment Delimiter: 0
(54-55)Length of the Data Section (2 bytes): Length of the data section+19
(56-57)Random Stuff (2 bytes): 13,0
(58-59)Length of the Data Section (2 bytes): Length of the data section+2
(60)Protected (1 byte): 6 if yes, 5 if no
(61-68)Program Name (8 bytes): Program Name (in ASCII)-fill with 0s if <8 bytes
(69-70)More Random Stuff (2 bytes): 0,0
(71-72)Length of the Data Section (2 bytes): Length of the data section+2
(73-74)Length of the Data Section (2 bytes): Length of the data section
(75-?)Data Section (Varies): The program's data
Checksum: Checksum of 56 bytes to the byte before the checksum

42
The Axe Parser Project / Speed
« on: July 18, 2011, 11:40:39 pm »
I'm writing my first major Axe program and I noticed that the speed isn't much faster than BASIC. Is this because my TI-84+ is too old? :(

43
Computer Programming / Opening a .8xp works... mostly. Help?
« on: July 17, 2011, 05:55:44 pm »
Well, I can open programs for the most part, but something's a little off. Here's what the program should be on-calc:
Code: [Select]
:"MIRAGEOS
Disp ""
For(A,1,3
Disp "  HELLO WORLD":End
Prompt 1,1,"----------------
And here's how it's opening in my program (TBEXE):
Code: [Select]
:"MIRAGEOS
Disp
DS<(""
ElseA,1,3
DS<("  HELLO WORLD":While
Prompt 1,1,"++++++++++++++++

Any ideas? I'm thinking I maybe forgot, it looks like, 3 commands in my tokens list? But that wouldn't explain the random DS<(...  ???

44
TI Z80 / TBEXE - Pre-alpha feature requests
« on: July 16, 2011, 06:41:17 pm »
Hello everyone! Even if you're not reading this, hello!

I'm BlakPilar, in case you didn't know that. However, this little forum post is for you! Yes, you! Not that chick down the hall, or that dude on the other side of the room- you. I'm working on a project called TBEXE (+1 if you can guess what it is without reading on.) It will allow anyone who decides to try it out to take their boring, old, bland .8xp programs and turn them into full-fledged executable programs for use on any Windows machine! With full access to color and processor speed! Yay!

Right now TBEXE is still very much in its infancy, which is the perfect time for me to be doing this kind of poll. I want you to ask yourself and anyone else who you think might download and/or use TBEXE when it is released what you would want in it. I want your ideas because I want to make this a lasting program that many people will use. Heck, if enough people want it, I'll draw a purple dinosaur and throw that in there. TBEXE is a program made by me, for you.

I have some obvious, common features planned, such as syntax highlighting, auto-complete/intellisense, code snippets, a WinForms designer (like the one in Visual Studio), plugin support, and possibly theme support. I have little to no creativity in my mind and I can't really think of any other features besides those aforementioned. Oh, of course you can also import and export as a .8xp, but some command syntax will be changed, not all commands will be supported when exporting to .exe, and some commands/functionality will be added.

So um... Yeah. Gimme suggestions ;D

--EDIT--
If you still don't understand what this is, here's a simple explanation:
I take your calculator-only .8xp programs and turn them into fully-functional .exe programs so you can use your calculator programs on the computer WITHOUT the need of an emulator. With the resulting executable file, you will be able to do everything with a normal computer program that the calculator can do with a calculator program. See EDIT3 if you're still confused.

--EDIT2--
TBEXE will be completely open-source! :D I'll be hosting it on Codeplex (and maybe here if I get the privilege >.>) as soon as it's ready for Alpha testing.

--EDIT3--
TBEXE will only support BASIC .8XPs. If you try to open an ASM compiled program, you'll get the same result as if you tried editing the same program on-calc after unlocking it using MirageOS or something similar. Because of the plugin support, if someone wants to write a plugin to handle decompiling of those ASM programs, go right ahead.

I probably left some stuff out  (I wrote EDIT3 quickly from my Zune HD), so if I did, just ask me and I'll get to you. Also, don't forget to give me suggestions! Thanks! ;D

45
Computer Programming / TBEXE - My pre-alpha public polling
« on: July 16, 2011, 04:38:43 pm »
I moved this- http://ourl.ca/12128

Pages: 1 2 [3] 4