LordJashin Posted November 5, 2012 Share Posted November 5, 2012 (edited) Ta da...We can now play most music files with SCAR now, but only for NON Commercial use, using the bass library. Change Log: ------------------------- LordJashin - 11\05\2012 : ------------------------- Added: Folder: - Divi\Libraries File: - Divi\Libraries\MoreKeyboardFunctions.dll - Divi\Libraries\MoreKeyboardFunctions.txt - Divi\Libraries\Bass.dll - Divi\Libraries\BassForSCAR.dll - Divi\Libraries\BassForSCAR.txt Divi\Misc\Logging.scar: - procedure OSI_SetupScriptInfo(sName, sVersion, sAuthor, sDescription, sCreated, sLastUpdated: string); Improvements: OSI.scar: - Loads MoreKeyboardFunctions.dll plugin - Loads Bass Plugin, and is setup in SetupOSI, if BASS is defined Divi\Level 1\Globals.scar: - Added to type TOSIScriptInfo: - ScriptInfoInLog: Boolean; - CustomLogHeaderForSaveLog: string; Divi\Misc\Logging.scar: - Added ability to add script info to logs using OSI_Log variable. Will only show if not blank '' - Added ability to use your own header in logs completely replacing OSI's header (For log saving) Divi\Testing\LoggingFunctions.scar: - Updated to use newest logging features - Changed OSILog -> OSI_Log Everywhere! New abilities: - Custom Headers in log saves (replace the ugly osi log header if you want ) - Script Info inside of header in log saves (only shows up if its not '' blank to begin with and custom header isnt used) Both of those things are inside the OSI_Log variable. Which was OSILog, but now its OSI_Log Check out the testing file that includes these new features here - https://github.com/OSI1/OSI1/blob/master/Divi/Testing/LoggingFunctions.scar Now onto the fun stuff, the BassForSCAR, and MoreKeyboardFunctions libraries! MoreKeyboardFunctions: {=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= Official SCAR Include MoreKeyboardFunctions.dll -------------------------------------------------------------------------------- * procedure VKKeybdDown(VKey: Byte); * procedure VKKeybdUp(VKey: Byte); * function VKSendKeyDown(VKey: Byte): Boolean; * function VKSendKeyUp(VKey: Byte): Boolean; -------------------------------------------------------------------------------- Last Modified: October 30th, 2012 These functions are for VK_ or VKey Codes only!!! example: VK_F1 or VK_DELETE About: This is a library LordJashin made from Delphi, that is loaded by OSI to extend SCAR and add some keyboard functions! At the moment, SCAR's KeyDown & KeyUp functions send SCAN CODES. But if you look at their params. They only allow a char to be in there, not a VKey. So we can't send a VKey as a Scan code with SCAR. Some games & applications will only accept the "simulated" input with the VKey sent as a scan code, and that is what these functions are for. VKKeybdDown & VKKeybdUp: Use the Windows API - keybd_event function which has been superceded by VKSendKeyDown & VKSendKeyUp: Which both use SendInput API which superceded (should be used) over the Keybd_event function. I provided both ways, just in case you wanted to try them out anyway, and to provide more... =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=} BassForSCAR: {=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= Official SCAR Include BassForSCAR.dll -------------------------------------------------------------------------------- * function Lib_Bass_IsLoaded: Boolean; * function Lib_Bass_Init(PathToBassDLL: string): Boolean; * function Lib_Bass_PlaySound(Path: string): Boolean; * function Lib_Bass_StopSound: Boolean; * function Lib_Bass_PlaySoundSimult(Path: string): Boolean; -------------------------------------------------------------------------------- Last Modified: November 5th, 2012 Sound files supported: WAV/AIFF/MP3/MP2/MP1/OGG About: Non Commercial ONLY! This is the rules for using BASS. Otherwise you must purchase a license. This means no making a script and then selling it if it uses BASS at all. This is a library LordJashin made from Delphi, that is loaded by OSI to extend SCAR and add some Sound functions! But in order for it to be loaded by OSI, you must put the {$DEFINE BASS} at the top of your script and use SetupOSI; SCAR's PlaySound function only allows .wav format at the moment. This allows you to play sound from SCAR, and even simultaneously if you want meaning, play 2 songs at the same time if you want using BASS_PlaySoundSimul with or without Lib_Bass_PlaySound. At the moment this only supports the formats listed. Might add more to the plugin to extend this, but this is it for now. Lib_Bass_IsLoaded, returns true if the Bass library was loaded by Lib_Bass_Init Lib_Bass_Init must be ran, and the Bass.dll must be loaded for any of the other functions to work. This is done automatically if you define BASS and use SetupOSI; before using any of the functions. =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=} I will tweak the bass library over time, they have tons of stuff you can do.. For now it can play: WAV/AIFF/MP3/MP2/MP1/OGG files types To get started using the bass library for SCAR just run this script and replace the 'PathToMusic.mp3' [scar] program New; {$DEFINE BASS} {$I OSI\OSI.scar} begin SetupOSI; Lib_Bass_PlaySound('PathToMusic.mp3'); end. [/scar] Edited November 5, 2012 by LordJashin Quote Link to comment Share on other sites More sharing options...
FHannes Posted November 5, 2012 Share Posted November 5, 2012 Tbh, I really don't see the point in being able to play these types of files with SCAR, which is why I removed bass from SCAR to begin with... Quote Link to comment Share on other sites More sharing options...
LordJashin Posted November 5, 2012 Author Share Posted November 5, 2012 Well, Janilabo has been using the sound functions lately so maybe he might find it useful. I wanted to experiment with a library and be able to use it in SCAR. It has been fun experimenting with sound libraries. Quote Link to comment Share on other sites More sharing options...
Janilabo Posted November 5, 2012 Share Posted November 5, 2012 Well, I think its great you are playing around with Delphi - and as they are in plugin, so it really doesn't matter. +It brings some extra functionality for those who have some need for it.. Experimenting is never a bad thing! Keep on working, LJ. Without experimenting we wouldn't progress with scripting/coding, or even discover things in the first place! Just my 2 cents! -Jani Quote Link to comment Share on other sites More sharing options...
FHannes Posted November 7, 2012 Share Posted November 7, 2012 I notice you do {$L Bass.dll} in OSI. $L only loads SCAR libraries... Quote Link to comment Share on other sites More sharing options...
LordJashin Posted November 7, 2012 Author Share Posted November 7, 2012 Was the only way I could get it to work, I'll post the source later... Quote Link to comment Share on other sites More sharing options...
LordJashin Posted November 7, 2012 Author Share Posted November 7, 2012 Ill post the source, whenever I can get this error I'm having fixed. I'm hoping Freddy can clear this up for me. Anyhow, look what i found O_O: "free color clicker" Lol.... Does SCAR still use this library? Looks to be the only one for delphi... Quote Link to comment Share on other sites More sharing options...
FHannes Posted November 7, 2012 Share Posted November 7, 2012 It does, yes, though there's plenty of graphics libraries out there for Delphi. Quote Link to comment Share on other sites More sharing options...
LordJashin Posted November 7, 2012 Author Share Posted November 7, 2012 Hmm, well the documentation for it, isn't the easiest to follow... And as for other graphics libraries, I couldn't really find any, sourceforge had this one for multiple formats though: http://freeimage.sourceforge.net/features.html I think I'm going to need to do more research on this. This library looks nice, I mean the layers thing is perfect. Just wish some one had some tutorials on it. Anyway, what other graphics library's are out there? I'm looking to be able to draw shapes (separate class) on either a TImage like component, or PaintBox, and be able to manipulate them with the mouse, and other things.... Quote Link to comment Share on other sites More sharing options...
FHannes Posted November 7, 2012 Share Posted November 7, 2012 (edited) You really don't need a graphics library to do that sort of low-end stuff... Delphi's own graphics library should have pretty much everything you need for pretty much everything. If you can't get things to work properly with that, it's unlikely you'll have more luck with a graphics library. http://stackoverflow.com/questions/9999166/delphi-image-canvas-paint-an-area-triangle-rectangle-polygons http://lmgtfy.com/?q=delphi+graphics+library ImageEn is a good example, it's commercial, but one of the most complete gfx libraries for Delphi. GDI+ is nice too. EDIT: And btw, don't be concerned about performance, TCanvas is very fast. It's very low level things like colorfinding that it's not good for. Unless you're running on an ancient machine, you don't have anything to worry about with most other applications. Just make sure you do double buffering properly. Edited November 7, 2012 by Freddy Quote Link to comment Share on other sites More sharing options...
LordJashin Posted November 7, 2012 Author Share Posted November 7, 2012 Yeah that's what I decided to do, I just want to get the basics down before worrying about flickering, and other things. That polygon function is awesome Quote Link to comment Share on other sites More sharing options...
FHannes Posted November 8, 2012 Share Posted November 8, 2012 Yeah that's what I decided to do, I just want to get the basics down before worrying about flickering, and other things. That polygon function is awesome Flickering is easy to solve with double buffering, there's plenty of resources online that show you how to implement drawing without flickering in components like the TPaintBox. Quote Link to comment Share on other sites More sharing options...
LordJashin Posted November 8, 2012 Author Share Posted November 8, 2012 (edited) Another thing I've been having trouble with, is getting a screen capture of a window. I got the GetDesktopWindow, capture down. But if I do an individual window, sometimes it messes up, especially if the application is maximized, it'll show beyond the screen boundaries and such. Was using GetWindowRect. The code is in the TPAGod project, which I'm going to update severely by 2morow or Friday... But here is the function as it stands now: [scar] procedure ScreenShot(hWin: Cardinal; activeWindow: Bool; destBitmap: TBitmap); var dc: HDC; w, h: Integer; r: TRect; begin if activeWindow then begin dc := GetWindowDC(hWin); GetWindowRect(hWin, r); w := r.Right - r.Left; h := r.Bottom - r.Top; end else begin hWin := GetDesktopWindow; dc := GetWindowDC(hWin); w := GetDeviceCaps(dc, HORZRES); h := GetDeviceCaps(dc, VERTRES); end; destBitmap.SetSize(w, h); try BitBlt(destBitmap.Canvas.Handle, 0, 0, destBitmap.Width, destBitmap.Height, dc, 0, 0, SRCCOPY); finally ReleaseDC(hWin, dc); end; end; [/scar] What's the secret to getting this to work?... For some reason it is cutting off the top of this: It took me a long time, to get this project this far. I will continue it, but I will revamp a lot of it. I will try to get core functionality working before messing with TPA's, T2DIntArrays and the like. And lists/w/e. Edited November 8, 2012 by LordJashin Quote Link to comment Share on other sites More sharing options...