Worklog for Baystep Productions

PsychoScript

Return to Worklogs

Alpha Soon?(Posted 2009-03-30)
Yup. Alpha soon. I've been creating a temporary IDE console for the scripting language. Nothing too fancy but something to do the job. So far the console opens and saves source-codes to tabbed text areas. Of course comes with color formatting so you can tell keywords from math and strings. Conveniently schemed like Blitz Max. It will compile with text output to the IDE. Working on a event system for it that will drive textual events to you for control. IE, when PS wants to print, you tell it where to print. This allows be to easily direct it from GUI output on PRINT to standard IO on PRINT. Cool?

The only thing that it really lacks is a Debugging system. Theres no step processing or pausing the execution. You press RUN and it Runs. I did still supply a Debug Log option for Run, which when active will output all variables functions and classes. There names and locations in PS memory.

The alpha test will be STAND ALONE. You won't have access to the PS3 Source Code, for reasons of if I sell it. You will be able to write, save, and execute, PsychoScript source code. And given that requests come in, I will add IDE Test Objects to play with in your scripts. Stuff like 2D Graphic objects, GUI Components, etc. This way you won't just write Command Line programs, but actually be able to come up with something with more "beef" to it. Share your scripts, give some comments!

As for internal workings. Class creation is done. It now separates variables functions methods etc. And saves them to its on memory bank. Properly names them and gives them unique location/ID numbers. Next up is objects. Which for me should be a variation of variables but links the class structure. Maybe extends? IDK. When it's all working and polished, I'll have that IDE Alpha Test for you guys.


Reality of PS3(Posted 2009-03-16)
NOTE: PS3 IS MY SHORT NAME FOR PSYSCHO SCRIPT 3, NOT PLAYSTATION! DUMMY!

PS3 (Psycho Script 3) is the BlitzMax version, previous worklogs may be confusing cause they are version 2 which was B3D. So remember, PS3 = BMAX.

PS3 Is comming along. Slowly cause I do a million things at once, but heres the reality of how its doing. And the best way to explain it is through my temporary documentation.

Take a look, and feel free to ask questions...

STATISTICS:
===========
Average execution: 100 lines of code in 2.721088ms OR 36770 lines of code in 1 seconds

KEYWORDS:
=========
var if elseif else endif
while endwhile repeat until forever
for next function endfunction
select case default endselect
method endmethod

COMPILER DIRECTIVES:
====================
Compiler directive commands start with # followed by the command/function. Refer to this list
of available compiler commands...
	#include "[source file]"
		include another source of the same type, ie: *.ps
	#library [lib name]
		selectivly include internal library, or extension if added. Requires only name
		not extension. ex: #library 3DMath
	#define [var name][<data type>] = [value]
		defines compiler variable. Pre-compiler will replace all instances of var with value.
	#declare scope [name] [hex value]
		defines custom scope level for hierachial execution on variables or functions.

COMMENTS:
=========
Line comments start with //
Block comments start with "comment" and end with "endcomment"

DATA TYPES:
===========
int%, float#, string$, long~, double!, hex&,
(pointer@)

Any data type can be passed as an array using [] or [size]

OPERATORS:
==========
Equal		==
Not-Equal	!=
More-Then/Equal	> >=
Less-Then/Equal	< <=

BUILT-IN FUNCTIONS:
===================
print(text$)
	note: Functions can be called with () or just spaces.
		ex. print(text$) [or] print text$
notify(text$,priority%)
	test$	  -	Text to be displayed
	priority% -	0=Regular 1=Serious 2=Crash

REFERANCE:
==========
Variables:
	var name[data type] = value
	ex: var age% = 18
	note: Data type can be set with either symbol or scope (ex. <string>)

If/ElseIf/Else Statements:
	if [variable][operator][variable/constant]
		...
	else
		...
	endif
	ex: if age >= 18

While Loop:
	while ([variable][operator][variable/constant])=TRUE
		...
	endwhile

Repeat/Until/Forever:
	Repeat
		...
	Until/Forever ([variable][operator][variable/constant])=TRUE

For/Next:
	for [variable] = [min] to [max] (step [value])
		...
	next

Select/Case/Default
	select [variable]
		case [value]
			...
		default
			...
	endselect

Functions:
	function [name][<return type>]([parameters]) [scope]
		...
	endfunction
	note: return type is the type of data returned. The scope effects the
	hierarchy of execution (Private,Public,Universal,Global,Local)

Classes:
	class [name] [scope]
		...
	endclass

Objects:
	obj [name][<class name>] [= [class name].[class constructor]([parameters])]
	[obj name].[obj field/function/method]
	notes:	for default constructors the optional equal field is usable.
		examples:
		   -Creation of object with default constructor
			obj billy<user> = user.Create("Billy")
		   -Calling object function to replace name
			billy.Rename(@...")
			   (note the @ sign is a pointer!)

Type-def:
	typedef [name]
		var byteSize = [value]
		var charType = [bool]
		var includeEOL = [bool]
		method Declare(value<byte[]>)
			..handle your value array..
		endmethod
	endtypedef
	notes: all fields and functions are required to prevent MAV.
	This specifically defines variable and return types for bypassing object
	usage.



The only things to look out for is that typedef isn't working yet. Because I want to polish the classes up.

But thats pretty much it for now. And that execution statistic is just a basic while loop running with variable assignment in each loop as to test the memory access to. Btw, my system is only P4 2.8gHz so anybody wanting to use this with say a DX10 system should be satisfied.

I'll be including an Event System and Condition/Trigger system to be included as library's. As well as inventory. So RPG games here I come.

Oh and btw on execution, functions and classes are extracted from the main execution source and saved in memory so that simple while loop is considered 3 even if you made a whole library of classes. They are on need to know basis :)

And the current line count of the whole PS3 code is:
Total Lines: 1681
Code Lines:  1623
Empty Lines: 58

Total Characters: 38845
Letters (a-z,A-Z,0-9,Symbols): 36523
White Space: 2322


Note: There may be a C port later on, as PSP Development can be used as well, one of my other hobbies.


Redesign(Posted 2008-09-15)
PsychoScript Version 3 is in Production.

It's a BMX Module now! And has some cool new features comming along, including a interpreter, compiler, and compiled interpreter along with debugging engine! WOOT!

Also now includes class, object, extend class, and overwriting for other classes/variables/functions. Going with the OOP approach here this will make this language 2x more useful than LUA in my book.

For example. And item system could have a base class built in to the engine and the custom items could just call something like....
Class ItemClassName Copy ItemDefaultClass
   //ONLY NEED TO OVERWRITE CERTAIN PARTS! WOOT!
   //EVERYTHING NOT OVERWRITEN PERFORMS DEFAULT ACTIONS
   var name:String = "Item Name"
   var itemAmmount% = 25
   var usesLeft% = 3
   Method _onPickup()
      RunSparkleEffect(this)
   EndMethod
   Method _onUse()
      RunSparkleEffect(this)
      If UseMe() Then DeleteFromInventory(this)
   EndMethod
   Method UseMe()
      Parent.healthPoints% += itemAmmount%
      this.usesLeft -= 1
      If usesLeft<=0 Then Return True //EMPTY SO DELETE
   EndMethod
EndClass


The engine automaticly takes events and searches for the most recent object by heirarchy (overwrites, callbacks, engine add-ons, engine defaults). Then calls the appropriate function using a "link-list" that parses and directs event calls appropriatly and efficiantly.


New Update(Posted 2008-05-20)
So I recently added the feature of being able to call functions in VARIABLE assignment. And also meaning getting RETURN values from FUNCTIONS. I will later add the ability to get RETURN types from CUSTOM FUNCTIONS in-script.

Unfortunatly IF/ELSE STATEMENTS do not accept FUNCTION returns. And neither do FUNCTION parameters. So if you want to use a FUNCTION to get a value or return something somehow, VARIABLES are the only way right now.

My next objective (and why I haven't done it yet IDK) is While, For, Repeat loops.


Late Intro(Posted 2008-05-20)
It's been a long long time since I started this project. But I'm just now starting a worklog cause its starting to look pretty nifty!

To give you a bit of an explanation. PsychoScript is a scripting language and engine/library for Blitz3D. It's an interpreted language and NOT compiled. I may develop a compiler later. But for now, purely interpreted.

Its features as of now are...
-Custom Functions in script.
-Call's back functions to your game.
-Enables game to supply Class/Object structures (useful for TYPEs like characters, items, etc.)
-Can create Global and Local variables with Integer, Float, String, and soon Pointer types.
-Use of If/Else statements.
-Custom Functions can over-ride built in ones.
-Can use math in variables like +,-,*,/ along with binary like &(and), |(or), %(mod), @(xor), and even use Functions whether custom, or built-in in variable assignment.
-Includes basic build in functions like Print, and Input, plus many others.
-Also includes math functions like Pi, Square, Square Root, Cos, Tan, Sin, etc.