concatenation
Blitz3D Forums/Blitz3D Beginners Area/concatenation
| ||
SaveImage (TestImage,"test" +(Frame) +".bmp") Will give me test1.bmp etc... SaveImage (TestImage,imagename$+(Frame)+".bmp" So how come this won't if I try to use a variable for the name in addition to a variable for which frame? |
| ||
Works fine for me, make sure the variable is global. Global imagename$ = "Picture" |
| ||
Yeah make sure that you're declring strings and ints correctly too: Compare: A_Variable=5 AnotherVariable=6 Print A_Variable+AnotherVariable+".bmp" Wih A_Variable=5 AnotherVariable$="6" Print Str(A_Variable)+AnotherVariable$+".bmp" |
| ||
imagename$ is global. I keep getting test.bmp1 test.bmp2 test.bmp3 instead of test1.bmp test2.bmp |
| ||
It does work, I use similar things all the time. I'm wondering though if your "imagename$" variable already has .bmp in it and you are appending the 2/3/4 etc on to it - and perhaps in your windows file folder view options you have known file type extensions hidden. This works fine: Function savemyimage(imagehandle,filename$,frame) if imagehandle = 0 then return -1 ;error else saveimage (imagehandle,filename$+str(frame)+".bmp") endif End Function |
| ||
imagename$+(Frame)+".bmp" can't possibly produce test.bmp1 test.bmp2 etc. You will have to show us some runnable code. |
| ||
Alright. I'm at work now but I'll get back to this in the a.m. cuz it don't seem to make anysense. I figure most likely it's somewhere else in the code that is doing it but I can't imagine why. |
| ||
Somewhere you've got the (Frame) after the ".bmp" soudns pretty obvious, but that would appear to be the issue. Might be related somewhere where you obtain an original filename that by default includes the extension, and you're not removing that extension to insert the frame variable? |
| ||
I was trying to change the animation name by opening a BlitzUI file requester and selecting a pic. Well, duh,it was assigning the full name of the file to imagename$...Fixed it by using an input box instead. Still could use tips on how to do "rubberbanding" to make rects and circles or to grab screen areas and code to magnify an area of my imageblock and display it on a seperate imageblock without hogging the program till it slows to a crawl. Thanks y'all. DOG |
| ||
Rather than using an input box simply use the file requester and remove the all characters after and including the "." in the filename (if it exists), then append it back on. |
| ||
Instead of using SaveFile, use "RunTimeError", "DebugLog" or just "Print" to check the filename that you are saving to. Maybe you have the 'hide extensions for known file types' option checked in Explorer? Your file would be called: test.bmp1.bmp but explorer doesn't show the last ".bmp" part. In Explorer->Tools->Folder options->View->Uncheck 'hide extentions for known file types'. |
| ||
Actually the input box works better than using a file requester. Somehow it just fits this program. I'm probably about done with it since basic scale and rotate commands in Blitz2d don't really work and I don't see much point in trying to do much more with it. |
| ||
This code procudes the correct results (Test1.bmp, Test2.bmp, ...):Global ImageName$ = "Test" For Frame = 1 To 10 Print ImageName$ + Str$(Frame) + ".bmp" ; Print MakeFileName$(ImageName$, Frame) Print "" Next WaitKey() End Function MakeFileName$(File$, Number) Return File$ + Str$(Number) + ".bmp" End Function If you want to use the function, just uncomment the commented "Print"-line and comment the other. The function basically does the same as the stuff behind the Print command. |
| ||
I have some functions somewhere (a combination of my own and some provided on code archioves) that deal with things like Getting the Path to Parent Directory of a file (i.e path minus actual filename + extensin) Getting the extension only Getting the filename only It's late for me now, but tomorrow I'll dig them out for you and post them here, they should be useful for this kind of stuff! |