Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 Souce - Program Console
Index -> Programming, Turing -> Turing Submissions
View previous topic Printable versionDownload TopicRate TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
Bored




PostPosted: Fri Jun 09, 2006 8:30 pm   Post subject: Souce - Program Console

This is a little something I've worked on for the last few days. simply it's just a console in whcih you can open and set things such as variables for your program. this is helpfull in debuging, adding in cheats, checking certain things, improving accuracy, etc. It is also set up for ease of adding in new capabilities. I have included in this the source code and an example program. Right now the following procedures are used to use the console.



proc AddVar (varAddr: addressint, name: string, vartype : string)
- adds a variable at address varAddr of type vartype to the consoles list to allow it to be used by console commands through the call of name.
ex. Console.AddVar (addr (health), "health", "int")
*Note: Compatible with int, string, boolean, and real types only

proc RemoveVar (varAddr: addressint)
- removes variable at address varAddr from the consoles list
ex. Console.RemoveVar (addr (speed))

proc CRemoveVar (call : string)
- removes variable with call name of call from the consoles list
ex. Console.CRemoveVar ("isDead")

proc AddArray (varAddr : addressint, low, high : int, name, vartype : string)
- adds an array of type vartype with address varAddr, lower bound of low and upper bound of high to the list of variables under name name(subscript)
ex. Console.AddArray (addr (pScore), 1, 4, "score", "int")
*Note: Compatible with int, string, boolean, and real types only

proc CRemoveArray (call : string)
- removes all elements of array an array with call sign call from the consoles list of variables
ex. Console.CRemoveArray ("itemNum")

proc AddCom (p : proc x (a : string), c : string)
- adds procedure p to the consoles list of commands under the call of c
ex. Console.AddCom (RemoveHealth, "damage")

proc RemoveCom (p : proc x (a : string))
- removes procedure p from console command list
ex. Console.RemoveCom (ToggleDeath)

proc CRemoveCom (call : string)
- removes procedure with call sign p from console command list
ex. Console.RemoveCom ("kill")

process Run
- runs the console or sets to current window if already running
ex. fork Console.Run

proc Quit
- ends the console and closes the window
ex. Console.Quit

proc SetVarWindow (windowID : int)
- sets the output window for shown variables to the window with id windowID
ex. Console.SetVarWindow (Window.GetSelect)

proc ToggleCls
- toggles between cls and non cls mode for the variable output window. in cls mode the window will be cleared before every drawing of variables and Updated after every drawing
ex. Console.ToggleCls

proc Message (msg : string)
- sends the message msg to the consoles output section
ex. Console.Message (">God mode enabled")
*Note: Replaces use of GUI.Addline (Console.texBox, msg)

proc Command (com : string)
- runs the console command com as if the user had inputted it to the console
ex. Console.Command ("show playerHealth")

The following are a list of the already present console commands, what they do and how to use them:

set var val
- sets the variable of call name var to value val
ex. set highscore 2500

get var
- tells you the value of the variable with call sign var
ex. get interest
console - interest = 0.005

exit
- exits the console and closes the window
ex. exit

show var
- makes the variable var visible in the variable output window
ex. show isDead

hide var
- makes the variable var invisible in the variable output window
ex. hide score

flash str *Example program only
- draws text str all over console
ex. flash Hello World!



Console Example.t
 Description:
Example Program

Download
 Filename:  Console Example.t
 Filesize:  2.21 KB
 Downloaded:  150 Time(s)


Console.tu
 Description:
Console Code

Download
 Filename:  Console.tu
 Filesize:  12.74 KB
 Downloaded:  142 Time(s)

Sponsor
Sponsor
Sponsor
sponsor
Bored




PostPosted: Sun Jun 11, 2006 1:49 pm   Post subject: Re: Souce - Program Console

I'm now working on improving including a remove variable and command byt call name procedure (probably will have tommorow). Creating more inbedded commands and designing to work well simeltaniously with runtime programs. I'll also be adding in boolean, and array capability with variable commands. That's all for now and i hope you will enjoy and find this usefull.[/quote]

I just added an update version. This one is now compatible with boolean types and allows for arrays to be added removed and used. when an array is added you can acess individual elements by using the call name of the array folowed by the subscript in brackets.
ex. array(sub)
But be carefull not to include a space between the two. the following is a complete list of updates and changes.

Added Features:
- array support
- boolean support
- removal by call names

Added Console Commands:
- none

Added Procedures:
- CRemoveVar
- AddArray
- CRemoveArray
- CRemoveCom
jamonathin




PostPosted: Sun Jun 11, 2006 8:56 pm   Post subject: (No subject)

Rather intersting program, and not that hard to implement into your program. I personally prefer put, only because that way I can watch the change of the variable. If i didn't need to watch the change, then that variable is only going to be a couple things - lil easier. Maybe that's something you could throw in later on.

But nonetheless, it works - haven't tested everything, but i'll take your word on it Wink.

Good job.

+ 15 Bits.
Bored




PostPosted: Sun Jun 11, 2006 9:18 pm   Post subject: (No subject)

That's a good Idea. Once I get it runnign smoothly with runtime programs I'll implement it. Also in the meantime if you actually want to use the program that is something that you could yourself implement. I've made implementing your own capabilities rather easy using the AddCom procedure. I'm gonna add in more capability to make implimenting commands and controling the console easier. I'll probably add in a procedure that will alow the program to call commands, and a SendMsg procedure that allows you to send a message to the console without using GUI.AddLine.
Bored




PostPosted: Tue Jun 13, 2006 1:26 pm   Post subject: (No subject)

I just added another update. This one incorperated jamonathin's idea into an imbedded command show and hide. I added in a process that constantly redraws all shown variables to the screen. Though this is rough it gets the job done and if your debugging usually graphically pleasing appearence of variables isn't that important. I also made it possible to change the window in which variables are displayed, and whether or not the process clears the screen. This allows it to display in it's own window if desired. Another change is the ability for the program to call console commands through the procedure Console.Command, and to send messages to the consoles textbox through Console.Message. This gives the program more control over the console and let's you implement it how you prefer. The following is a complete list of updates and changes.

Added Features:
- window problems somewhat fixed
- program control feover console
- variable drawing

Added Console Commands:
- show
- hide

Added Procedures:
- ToggleCls
- SetVarWindow
- Message
- Command
Display posts from previous:   
   Index -> Programming, Turing -> Turing Submissions
View previous topic Tell A FriendPrintable versionDownload TopicRate TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 1  [ 5 Posts ]
Jump to:   


Style:  
Search: