FHannes Posted April 4, 2012 Share Posted April 4, 2012 (edited) I've created a repository where I'm going to dump samples for creating libraries, writing scripts, includes, ... I'm hoping it will be a valuable resource for scripters. https://github.com/SCAR-Divi/Samples (Note that you need at least SCAR Divi 3.33 Beta to run the library samples.) Edited April 30, 2013 by Freddy Quote Link to comment Share on other sites More sharing options...
shadowrecon Posted April 4, 2012 Share Posted April 4, 2012 Nice I like this! Very clear and straight forward. Quote Link to comment Share on other sites More sharing options...
Bixby Sayz Posted December 6, 2012 Share Posted December 6, 2012 Freddy, in your what version of scar do the Legacy and Main constants refer to? (What version of scar is required for those using the MAIN plugin architecture) Doesn't really matter other than adding some comments to your examples so I don't have to spend time figuring things out every time I want to look at writing a plugin for SCAR. Quote Link to comment Share on other sites More sharing options...
FHannes Posted December 6, 2012 Author Share Posted December 6, 2012 The main plugin architecture was introduced in SCAR Divi 3.35 and Legacy will (should) work in all versions 3.25 and above. Quote Link to comment Share on other sites More sharing options...
LordJashin Posted December 6, 2012 Share Posted December 6, 2012 I recommend using the "legacy", because I failed many times to get the new one to work...with certain things, and even simple things sometimes.... Quote Link to comment Share on other sites More sharing options...
FHannes Posted December 6, 2012 Author Share Posted December 6, 2012 Don't use legacy, this is outdated and will not be supported indefinitely. Quote Link to comment Share on other sites More sharing options...
Bixby Sayz Posted December 7, 2012 Share Posted December 7, 2012 The main plugin architecture was introduced in SCAR Divi 3.35 and Legacy will (should) work in all versions 3.25 and above. Thank you that was exactly what I was looking for. Plan on using the Main anyway but was curious about what the cutoff versions where. Love ya man, but your documenting skills need some work. I recommend using the "legacy", because I failed many times to get the new one to work...with certain things, and even simple things sometimes.... Yeah having a devil of a time getting the new plugin system to work. Creating a new Delphi project and adding his files to it does not behave the same as modifying his sample project. There must be some hidden settings in his Project settings I haven't figured out yet. I have yet to get a from scratch dll to work properly with SCAR. Quote Link to comment Share on other sites More sharing options...
Bixby Sayz Posted December 10, 2012 Share Posted December 10, 2012 (edited) I recommend using the "legacy", because I failed many times to get the new one to work...with certain things, and even simple things sometimes....Have you tried the latest version of Freddy's basic_exports.dll. Compiles fine in Delphi now but still can't get it to call from SCAR. Just wondering if I'm doing something wrong. Edit: Has to be something with my Delphi setup? Just tried compiling ShellUtils. Same error: SCAR not reading exported functions and thus giving a compile error. Use Freddy's pre-compiled binary and it works fine. Compiling on Win 7 x86 and running on Win 7 x64. Shouldn't make a difference since SCAR and .dll are both 32 bit??? Edit2: How interesting. Solved problem with ShellUtils: Someone was being a dumbass and using {L ShellUtils.dll} instead of {$L ShellUtils.dll}. But basic_exports example gives a bizarre run time error: Unable to register type: bunch of unintelligible characters. This is the sample project just downloaded the latest version a few minutes ago. Have to look closer at this... Edited December 10, 2012 by Bixby Sayz Quote Link to comment Share on other sites More sharing options...
LordJashin Posted December 10, 2012 Share Posted December 10, 2012 Until support for legacy is dropped, forget it. Not worth messing with, take it from some one who's messed with it to the point of no return Quote Link to comment Share on other sites More sharing options...
FHannes Posted December 10, 2012 Author Share Posted December 10, 2012 (edited) Until support for legacy is dropped, forget it. Not worthmessing with, take it from some one who's messed with it to the point of no return If you know what you're doing, it works just fine. As demonstrated by https://github.com/FHannes/SMART-Remote-Wrapper/ Have you tried the latest version of Freddy's basic_exports.dll. Compiles fine in Delphi now but still can't get it to call from SCAR. Just wondering if I'm doing something wrong. Edit: Has to be something with my Delphi setup? Just tried compiling ShellUtils. Same error: SCAR not reading exported functions and thus giving a compile error. Use Freddy's pre-compiled binary and it works fine. Compiling on Win 7 x86 and running on Win 7 x64. Shouldn't make a difference since SCAR and .dll are both 32 bit??? Edit2: How interesting. Solved problem with ShellUtils: Someone was being a dumbass and using {L ShellUtils.dll} instead of {$L ShellUtils.dll}. But basic_exports example gives a bizarre run time error: Unable to register type: bunch of unintelligible characters. This is the sample project just downloaded the latest version a few minutes ago. Have to look closer at this... Are you still having issues? That screenshot looks like you're having a unicode related problem. EDIT: I took a look and there appears to be an issue with type exporting in the sample, I'll have a closer look and commit a patch. EDIt2: I've committed a fix, it should work fine now. The OnGetTypeInfo function had an extra parameter where it shouldn't have for some reason. Edited December 10, 2012 by Freddy Quote Link to comment Share on other sites More sharing options...
Bixby Sayz Posted December 10, 2012 Share Posted December 10, 2012 EDIt2: I've committed a fix, it should work fine now. The OnGetTypeInfo function had an extra parameter where it shouldn't have for some reason. Nice to know I'm not losing my mind (always a possibility). I'll check it out later. Off Xmas shopping with my wife today. Joy!!!!!!!!!! Quote Link to comment Share on other sites More sharing options...
FHannes Posted December 10, 2012 Author Share Posted December 10, 2012 Nice to know I'm not losing my mind (always a possibility). I'll check it out later. Off Xmas shopping with my wife today. Joy!!!!!!!!!! Well, I'm glad you brought the issue to my attention. If everyone would keep using the legacy system, these things would keep going unnoticed. Quote Link to comment Share on other sites More sharing options...
LordJashin Posted December 10, 2012 Share Posted December 10, 2012 Well, I'm glad you brought the issue to my attention. If everyone would keep using the legacy system, these things would keep going unnoticed. O they were noticed. Way back before now. The legacy system is great, it saves time, and has a better appearance by far. Cheers for legacy, and screw windows 8. The start button was such a good thing to have Quote Link to comment Share on other sites More sharing options...
Bixby Sayz Posted December 10, 2012 Share Posted December 10, 2012 Cheers for legacy, and screw windows 8. The start button was such a good thing to have Lol. Now be open. Different is not necessarily bad. It just means a bit of floundering while you figure how to do things the new way. Quote Link to comment Share on other sites More sharing options...
FHannes Posted December 10, 2012 Author Share Posted December 10, 2012 O they were noticed. Way back before now.The legacy system is great, it saves time, and has a better appearance by far. Cheers for legacy, and screw windows 8. The start button was such a good thing to have Unnoticed by me if no one tells me about it... Quote Link to comment Share on other sites More sharing options...
Bixby Sayz Posted December 10, 2012 Share Posted December 10, 2012 Works like a charm for me now. Thanks Freddy. Now I can have a go at my own .dll using the MAIN architecture. On a side note, with something like this should we use the bug tracker or no? Quote Link to comment Share on other sites More sharing options...
FHannes Posted December 10, 2012 Author Share Posted December 10, 2012 Yeah sure, for the samples that's certainly ok Quote Link to comment Share on other sites More sharing options...
Bixby Sayz Posted December 10, 2012 Share Posted December 10, 2012 Okay will do. Spoke to too soon on having it working heh heh. My test script was calling the legacy version of samples. Newest build locks SCAR up solid when it load the library. F**k me this is turning out to be way more difficult than it should be. I spent years designing and developing a multi-tier database app and flying around the country deploying/training/supporting it. And yet I can't get a simple dll to build and call it. Wish I could see the look on my own face right now. Feel like such an idiot trying to get this going. Quote Link to comment Share on other sites More sharing options...
FHannes Posted December 10, 2012 Author Share Posted December 10, 2012 Can you compile/run the sample dll with the included basic_exports.scar script? Quote Link to comment Share on other sites More sharing options...
LordJashin Posted December 10, 2012 Share Posted December 10, 2012 Okay will do. Spoke to too soon on having it working heh heh. My test script was calling the legacy version of samples. Newest build locks SCAR up solid when it load the library. F**k me this is turning out to be way more difficult than it should be. I spent years designing and developing a multi-tier database app and flying around the country deploying/training/supporting it. And yet I can't get a simple dll to build and call it. Wish I could see the look on my own face right now. Feel like such an idiot trying to get this going. I KNEW IT > welcome to jashinville Quote Link to comment Share on other sites More sharing options...
Bixby Sayz Posted December 11, 2012 Share Posted December 11, 2012 I KNEW IT > welcome to jashinville Yeah, this is not fun. Blew everything away and started over. Main version of samples works fine now (appears to), and have my own "built from scratch" .dll working and returning values but it doesn't want to do any of the callbacks to SCAR functions yet. Been too long of a day and I'm tired enough I'm just spinning my wheels. I'll have a go at it again tomorrow. Quote Link to comment Share on other sites More sharing options...
FHannes Posted December 11, 2012 Author Share Posted December 11, 2012 Yeah, this is not fun. Blew everything away and started over. Main version of samples works fine now (appears to), and have my own "built from scratch" .dll working and returning values but it doesn't want to do any of the callbacks to SCAR functions yet. Been too long of a day and I'm tired enough I'm just spinning my wheels. I'll have a go at it again tomorrow. I am calling WriteLn in the dll, you could look at that as an example. If you're stuck, you can always PM me your code and I can take a look at it. Quote Link to comment Share on other sites More sharing options...
Bixby Sayz Posted February 5, 2013 Share Posted February 5, 2013 I recommend using the "legacy", because I failed many times to get the new one to work...with certain things, and even simple things sometimes....You ever get this going? Finally managed to get this working with the MAIN architecture. Rewrote Freddy's example a bit to add comments and structure it so it flows like I think (and not like Freddy thinks). Found a bug too that most likely will never surface, but I'll report it anyway. Quote Link to comment Share on other sites More sharing options...
LordJashin Posted February 7, 2013 Share Posted February 7, 2013 Legacy has always worked. And should be still working even now...just take a look at the defines in OSI.scar lols o and man 1k posts Quote Link to comment Share on other sites More sharing options...
Bixby Sayz Posted February 7, 2013 Share Posted February 7, 2013 Newer (MAIN) plugins aren't that bad once I added some comments to Freddy's code so I could follow along and rearranged things a bit internally. COMMENTS PEOPLE! COMMENTS!!! (I sound like a broken record) I am curious why he chose to implement his function list as a constant rather than stuff it in a variable. My version does that: took me a while though to remember/figure out how to bulk load an array of records. Plus I think my install of Rad Studio XE2 was a bit wonky. Reinstalled into a clean virtual machine and seems to be working better now. Oh, and grats on the 1K posts. Quote Link to comment Share on other sites More sharing options...