Help function doesnt return value
Blitz3D Forums/Blitz3D Programming/Help function doesnt return value
| ||
Hi, can someone tell me why this wont return the string astream$ ? Any help would be GREATLY appreciated :) ~DS~ |
| ||
The function declaration needs to match the returned type, i.e. To return a string: Function Filea$() To return a float: Function Filea#() You can also get functions to return custom types but again, the function declaration must match. |
| ||
That helped a little. Now it returns nothing. Whats wrong w/ my read code? i need it to read the 1st line, so it can play playlists ^^ Thanks again gfk! :) |
| ||
Function myfunc$() Return "Hai Thar! kthxbai!" End Function Print myfunc() This belongs in the beginner forum. If your function does not return a value have you debugged the return variable just before the return? |
| ||
it may belong there, however, if you guys wanna see a new dreamplayer, i need this function fixed w/ any help I can get it :) Thanks! ~DS~ |
| ||
DREAMPLAYER is from hectic and the source is only to learn how to use bass. Dont write a "new dreamplayer", write your own player. ;) bye |
| ||
I'm not writing a new player. I modded the source so it has more things u can do. Check your BBS 1.7.0 post as well ^^ ~DS~ |
| ||
... if you guys wanna see a new dreamplayer, i need this function fixed w/ any help I can get it :) I use WinAmp + VLC, thank you. But to get back to the subject: Copy and paste this code into your Biltz3D IDE and run it. Notice how the debugger stops at the Stop statement. Also note how you are able to inspect the a$ variable (see it contents) by expanding the "myfunc()"-node in the debugger tree. If you do something similar in your code you'll be able to see the contents of your string, in your function also. Function myfunc$() a$ = "Oh, Hai Thar! kthxbai!" DebugLog a$ Stop Return a$ End Function Print myfunc() |
| ||
ok. weird.. astream$ returns the string, yet it STILL wont play: http://stream-10.ssatr.ch:80/rsc/mp3 if i use: FBassHandle=BASS_StreamCreateURL(Filea$(),0,BASS_SAMPLE_LOOP,0,0) |
| ||
The next natural step in the debugging is this:temporary$=Filea$() DebugLog temporary$ Stop FBassHandle=BASS_StreamCreateURL(temporary$,0,BASS_SAMPLE_LOOP,0,0) And of course also to check the documentation of the BASS_StreamCreateURL()-function to check if you use it correctly. (and in the correct context) edit: spelling + added "context" |
| ||
somehow, the prob fixed itself thanks for all the help! :) ~DS~ @mods, close this plz |
| ||
hmm not everyone has a G: drive, so if this is to become an exe dont hard link to places that may not exist ;) |
| ||
yea. hehe. its already been taken care of :) thx for tellin me however :) ~DS~ |
| ||
somehow, the prob fixed itself An anecdote on this subject: One of the greatest programmers I've met IRL thought me to never accept fixes I didn't understand. He was my supervisor at the time and I was a junior programmer and he always had me show the before- and after-code and I had to explain to him why this fix would solve the problem. The fun part was that I often saw flaws in my "new solution" while explaining to him why it (supposedly) solved the problem. I'm not saying you must do this, but it sure was a fantastic way of learning alot. |
| ||
Ok, one time i will talk for DSW Thats a known problem (if your www connection is ok) Always use HWND to init bass and use BASS_FREE to close the programm (dont close the window, but use ESC with Bass_Free()).Else it is possible that the bass lib is not "killed" correctly by windows. Normaly no problem, but on URL your system can block outgoing connections(Security) Sorry, my english is not good enough to explain 100%. cu |
| ||
Mahan, could you help abrexxes explain 100% plz? i understand most of it, it's just i wonder if this bug is fixed in 1.7? ~DS~ |
| ||
Thats not a bug, but a role/law of Microsoft/Windows. Use HWND to init, close your programm with Bass_Free() There is nothing that i can fix. bye |
| ||
I see. Ok, will do :) Thx Abrexxes :) |