ARGHness!
Fine, here it is, as I trust its "safe".
One day while looking at the SCAR manual, I saw FastGetPixel and FastSetPixel.
Later, I realized you could use these to store data in a bitmap as "colors" you would just add or change the color of a pixel on a bitmap, and then you could read it. After thinking a while, I realized I could store (limited) floating point numbers also, using HSL, and also booleans by storing values 1 and 0 (I created InToBool and BoolToInt).
THEN, I also realized you could save the bitmap, and keep script settings if you had to terminate (EX. The loads if it stopped unexpectedly), or script settings. You can also start off with a 1 * 1 bitmap, as it just makes the bitmap bigger if you add pixels…
program New;
//{.Include SRL/SRL.scar}
function IntToBool(TheInt: Integer): Boolean;
begin;
If (TheInt = 0) Then
Result:= False;
else
Result:= True;
end;
function BoolToInt(TheBool: Boolean): Integer;
begin;
If not (TheBool) Then
Result:= False;
else
Result:= True;
end;
{ function SetIntBMP ]
[ ]
[ Desc. : Returns True if it had to split the integer in half to ]
[ store it. In which case, you must specify if it has been ]
[ split on retrieval }
function SetIntBMP(BitMSet, Valu, X, Y: Integer): Boolean;
begin;
If not (Valu > 16777215) Then
begin;
FastSetPixel(BitMSet, X, Y, Valu);
Result:= False;
end else
begin;
FastSetPixel(BitMSet, X, Y, Round(Valu - Round(Valu/2)));
Result:= True;
end;
end;
function SetFloatBMP(BitMSet, X, Y: Integer; Valu: Extended): Boolean;
Var
S, L, sValu ssValu: Extended;
begin;
If not (Valu > 16777215) Then
begin;
sValu:= Valu - Round(Valu);
ssValu:= sValu - (sValu / 2);
FastSetPixel(BitMSet, X, Y, HSLToColor(Valu, ssValu, ssValu));
Result:= False;
end else
begin;
sValu:= Valu - Round(Valu);
ssValu:= sValu - (sValu / 2);
FastSetPixel(BitMSet, X, Y, HSLToColor(Valu/2, ssValu, 0.0));
Result:= True;
end;
end;
function SetBoolBMP(BitMSet, X, Y: Integer; Valu: Boolean): Boolean;
begin;
Result:= Valu;
FastSetPixel(BitMSet, X, Y, BoolToInt(Valu));
end;
function ReadIntBMP(BitMSet, X, Y: Integer, Halved: Boolean): Integer;
begin;
If (Halved) Then
Result:= FastGetPixel(BitMSet, X, Y) * 2;
else
Result:= FastGetPixel(BitMSet, X, Y);
end;
function ReadFloatBMP(BitMSet, X, Y: Integer; Halved: Boolean): Extended;
Var H, S, L, sValu: Extended;
begin;
If (Halved) Then
begin;
ColorToHSL(FastGetPixel(BitMSet, X, Y), H, S, L);
Result:= H+S+L*2;
end else
begin;
ColorToHSL(FastGetPixel(BitMSet, X, Y), H, S, L);
Result:= H+S+L;
end;
end;
function ReadBoolBMP(BitMSet, X, Y: Integer): Boolean;
begin;
Result:= IntToBool(FastGetPixel(BitMSet, X, Y));
end;
begin;
end.
{
<OWNER> = User under the alias of R0b0t1
<ORGANIZATION> = R0b0t1
<YEAR> = 2007
Copyright (c) <YEAR>, <OWNER>
All rights reserved.
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above
copyright notice, this list of conditions and the following
disclaimer in the documentation and/or other materials provided
with the distribution.
* Neither the name of the <ORGANIZATION> nor the names of its
contributors may be used to endorse or promote products derived
from this software without specific prior written permission.
* You may not use this software for personal gain and/or bussiness
purposes without specific prior written permision.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. }
I also started wondering about speed, and realized as long as you had tonnes of variables (Like Wizzup?'s miner) it might be worth it, though its main percs would be savability.
I would be happy if someone who does/use to program for a living would post there ideas. (Wizzup? !).
See? Thats all it is. I don't think its extremely awesome. Sorry for all of the hype :p.
EDIT: Sorry for seeming really smart in my above posts… I was just ranting on a different forum. (You gotta sound smart then!)