![]() ![]() |
![]() ![]() Post #1 | |
Newbie In Training Posts: 17 Joined: 23-November 11 ![]() | For my mod, I will create a folder in CLEO folder, so the directory will be CLEO\SAPDFR\Addons. This is where people can create addons for my mod and add them in the folder so they can be executed from the main cleo script. Can someone write a sample script for me that shows how to get the file names in the directory and start that script? Also, is it possible for a CLEO script to get the name of the directory it's in? This post has been edited by HeresOtis: Jul 3 2012, 09:39 PM |
![]() Post #2 | |
![]() Trained Member Posts: 76 From: Nederland, NL Joined: 1-May 12 ![]() | So you don't know the file name and directory? Can't you just let people merge it into one known file? AFAIK it isn't possible to get the directory in cleo. You can get the file name though. This post has been edited by badboy: Jul 3 2012, 11:30 PM |
![]() Post #3 | |
![]() Coding like a Rockstar! ![]() Posts: 1,468 From: ??? Joined: 28-May 09 ![]() | Check this out: http://gtagmodding.com/opcode-database.php?opcode=0AE6 -------------------- | CLEO 4.3.22 | A?i?a?o?3D | UI SDK | Black Market Mod 1.0.1 | GInput 0.3 | Cheat Keyboard | Tactile Cheat Activation | Stream Ini Extender 0.7 | SuperVars | ScrDebug | Vigilante Justice: San Andreas | |
![]() Post #4 | |
Newbie In Training Posts: 17 Joined: 23-November 11 ![]() | DK22Pac gave me a sample on GTAF: CODE if 0AE6: 0@ = find_first_file "CLEO\IVLM\*.lm" get_filename_to 1@v //IF and SET then repeat 0AD3: 5@v "IVLM\%s" 1@v 0A92: create_custom_thread 5@v until 8AE7: not 1@v = find_next_file 0@ //IF and SET 0AE8: find_close 0@ end Can someone answer this though: Also, is it possible for a CLEO script to get the name of the directory it's in? |
![]() Post #5 | |
![]() Trained Member Posts: 76 From: Nederland, NL Joined: 1-May 12 ![]() | You already have the directory. That code doesn't search in subdirectories. This post has been edited by badboy: Jul 4 2012, 12:49 PM |
![]() Post #6 | |
![]() Coding like a Rockstar! ![]() Posts: 1,468 From: ??? Joined: 28-May 09 ![]() | What do you mean? If you know it's gonna be in "CLEO\IVLM" then you shouldn't need to get the name of the directory... 0AE6 doesn't retrieve files in subdirectories, but it does retrieve subdirectories themselves. So if you want subdirectory searching (it's gonna be tricky), you have to append 1@v (like so: "CLEO\IVLM"+ 1@v +"*.lm") to the search path, then perform a new search as a subroutine. -------------------- | CLEO 4.3.22 | A?i?a?o?3D | UI SDK | Black Market Mod 1.0.1 | GInput 0.3 | Cheat Keyboard | Tactile Cheat Activation | Stream Ini Extender 0.7 | SuperVars | ScrDebug | Vigilante Justice: San Andreas | |
![]() Post #7 | |
Newbie In Training Posts: 17 Joined: 23-November 11 ![]() | How come this keeps on looping? I did a test with it and it creates the scripts, but after the last file, it goes back to the first file and creates them over and over again. I use it as a gosub command. CODE :CreateRoutinePatrolScripts if 0AE6: 0@ = find_first_file ROUTINEPATROL_Directory get_filename_to 4@v //IF and SET then repeat 0AC8: 8@ = allocate_memory_size 50 0AD3: 8@ "SAPDFR\RoutinePatrol\%s" 4@v 0A92: create_custom_thread 8@ until 8AE7: not 4@v = find_next_file 0@ //IF and SET 0AE8: find_close 0@ 0AC9: free_allocated_memory 8@ end return |
![]() Post #8 | |
![]() I will kill you Posts: 126 Joined: 13-May 11 ![]() | QUOTE How come this keeps on looping? I did a test with it and it creates the scripts, but after the last file, it goes back to the first file and creates them over and over again. I use it as a gosub command. Don't know, but you're leaking memory in the repeat...until loop. You're allocating a new memory block on each loop iteration and only free the last allocated block. |
![]() ![]() |