New games every week!
Yesterday's Doings
9th March 2021  
Ugh.. That script engine isn't coming together very well.


"Regex is awesome, though. Use Regex!" came the calls from over the web. It makes sense. Regex is super-powerful, and fast, and awesome.
But trying to get it to do what you want it to do is a skill best left to those who can manage to control the chaos of CSS.
I am no CSS-Tamer. And apparently I'm not a Regex-Overlord, either.

I've got to the point where I can recognise punctuation, determine if things are values, variables, or function names, and things like that.
All good.

Then I take one look at this line of code...
Text Rand(0,100)+50*10,Rand(0,100+50),"This is \"Some Text\", which is "+RandFrom("nice","ugly","strong","a banana")+".",1

From which I can see there's a ton of commas, and bits inside and outside of quote-marks, and bits inside brackets and not.
.. I can SEE that..
But code that!?!
In Regex!?!?!!

Yesterday I decided to scrap the lexer that I'd got working last week, and instead write my own from scratch, doing things oldskool.
Start from the left, go all the way through character by character, figure out what's what, and organise it all properly.
Regex can take a hike!!!


In the same vein, I figured it's probably about time that I start writing a series of functions for PHP to continue my standardising of my code.
I've started to create a set of my all-too-familiar commands in a PHP script, mostly dealing with image buffers, drawing and that sort of thing.
You might've noticed the recent switch from pixel-font back to the old scribble font, in the Poetry images on the site. This uses the new set of commands, and the resulting code is much more readable than PHP's default command set!!

Having Globals that remember things, like current fonts and colours, and then use them inside of function, instead of having to manage and include them in EVERY SINGLE command, is an absolute godsend.

Since getting PHP8 installed on the Mac, for Command-Line purposes, I've come to learn about a whole host of new functionality that I never previously considered.
It really is a lot more powerful than I previously gave it credit for.
Sure, it's been running my websites for the past decade-or-so, but the things it can do on your desktop/laptop is actually rather interesting.

Much like my shift to Javascript based gaming, the simplicity of PHP-based tools is alarmingly functional, and fun to play with

Views 92, Upvotes 2
Daily Blog , Scripts , Jse
New games every week!
Site credits : Jayenkai
(c) Jayenkai 2017 and onwards, site design Rychan. RSS feed
Blog - Yesterday's Doings - AGameAWeek