Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

DarkBASIC Professional Discussion / Reading just last content from file

Author
Message
Rims Flames
11
Years of Service
User Offline
Joined: 5th Apr 2014
Location:
Posted: 10th Jul 2014 11:58
Hello,

I have this code pasted in a text file "volume = 71" and i want darkbasic professional to read just "71" and ignore "volume = ". How can i possibly do this? Thank you very much!

Rims Flames
TheComet
17
Years of Service
User Offline
Joined: 18th Oct 2007
Location: I`m under ur bridge eating ur goatz.
Posted: 10th Jul 2014 12:07
I recommend getting yourself the Matrix1 Utils plugin here: http://forum.thegamecreators.com/?m=forum_view&t=85209&b=18

Then using the command split string.


Rims Flames
11
Years of Service
User Offline
Joined: 5th Apr 2014
Location:
Posted: 10th Jul 2014 16:33
Hey TheComet,
I appreciate your response, i think its my fault that i can't seem to get the code work.

This is my code:



A big thank you!

Rims Flames
TheComet
17
Years of Service
User Offline
Joined: 18th Oct 2007
Location: I`m under ur bridge eating ur goatz.
Posted: 10th Jul 2014 17:29 Edited at: 10th Jul 2014 17:30
What "doesn't work"? For all I know the error could be you pouring coffee over your keyboard and breaking it, then complaining that your F5 key "doesn't work". Give some more info!

You should also learn how to indent your code properly - indent whenever you open a command with a counterpart, and unindent when you get to said counterpart (examples: if/endif, for/next, do/loop, open to read/close file, etc.)

Properly indented code:


MrValentine
AGK Backer
14
Years of Service
User Offline
Joined: 5th Dec 2010
Playing: FFVII
Posted: 10th Jul 2014 20:12
If Matrix1Utils supports INI files, I would suggest using that and format your file accordingly, but then I am only assuming all the values in that file are in that fashion...

If not, ignore what I said...

You can use INI files with STYX which is what I use...

Or CSV files with Enhancement Pack

Or Just use Matrix1Utils for similar functionality

Rims Flames
11
Years of Service
User Offline
Joined: 5th Apr 2014
Location:
Posted: 10th Jul 2014 20:44
I meant that the sound doesn't open at all when i put the value of set music volume 1, volume... that is the problem

Rims Flames
Rims Flames
11
Years of Service
User Offline
Joined: 5th Apr 2014
Location:
Posted: 10th Jul 2014 20:45
I understand, MrValentine

Rims Flames
MrValentine
AGK Backer
14
Years of Service
User Offline
Joined: 5th Dec 2010
Playing: FFVII
Posted: 10th Jul 2014 21:44 Edited at: 10th Jul 2014 22:16
Umm try using 71.0 I believe you have to use floats... Old info...

EDIT

Ignore that about floats... it states integers in documentation [ EDIT I never use the default sound commands ]

I put this together really quickly... I could test with OGG but I do not know if M1U has support for that...



EDIT

Should be right now, silly escape sequences... umm corrections made... Added fun Print x so you can see the actual value as per volume level...

MrValentine
AGK Backer
14
Years of Service
User Offline
Joined: 5th Dec 2010
Playing: FFVII
Posted: 10th Jul 2014 22:36
Just a bump for Rims Flames to let you know I have updated my post above... double posting is frowned upon on here so try to keep it to a minimum... even though you might be using it properly...

Rims Flames
11
Years of Service
User Offline
Joined: 5th Apr 2014
Location:
Posted: 10th Jul 2014 23:35
Yeah well your code is pretty much doing all the stuff through code, however my idea was to get the volume val from a file... like, i have an external application made in visual studio, linked in my dbpro application, setting the volume vals through that visual studio app, the visual studio app saves a file with the volume val and then the dbpro app must read before the loop the volume val from that file.

Rims Flames
MrValentine
AGK Backer
14
Years of Service
User Offline
Joined: 5th Dec 2010
Playing: FFVII
Posted: 10th Jul 2014 23:43
I wanted to make sure you were not confusing sound levels...

What else is in that file? Are all the data samples in the same format?

Did you try what TheComet suggested?

Try setting volume as a global at the start of your code...

Rims Flames
11
Years of Service
User Offline
Joined: 5th Apr 2014
Location:
Posted: 11th Jul 2014 00:22
Well, volume is in the same function so i don't think that is the problem. I tried what TheComet suggested, i am using it's code but no result.

Rims Flames
Rims Flames
11
Years of Service
User Offline
Joined: 5th Apr 2014
Location:
Posted: 11th Jul 2014 00:22
this is the stuff that is in the file



Rims Flames
MrValentine
AGK Backer
14
Years of Service
User Offline
Joined: 5th Dec 2010
Playing: FFVII
Posted: 11th Jul 2014 03:38 Edited at: 11th Jul 2014 03:41
I set up everything as it is in your project, loaded a music file, looped it, used STYX's SPLIT command instead of Matrix1Utils as I do not use that, and everything worked fine, no globals.. I had to use a slightly different method than the one above just made me declare split as a string before using it, but you can just use any variable with $ at the end of it LocalValue1$ for example

Which Synergy editor and DBPro release are you using?


AAAAAAAAAAAAHHHHHHHH TheComet

Step back a moment...

Quote: "What "doesn't work"? "


Matrix1utils

I suppose this is not installed on her/his system that is why the code you provided is not working.......

EDIT

Looking back up, the reply was code not working, but no mention of having viewed that link and downloaded M1U

Rims Flames
11
Years of Service
User Offline
Joined: 5th Apr 2014
Location:
Posted: 11th Jul 2014 10:46
I did viewed the page however darkbasic pro in my pc had this plugin, i resolved the problem, i eliminated from the text file the "volume = ", i made it easy just put the variables in the second line. I think the fact is that dbpro red all the second string including the "volume = ". But thank you so very much for your help!

Rims Flames
Phaelax
DBPro Master
22
Years of Service
User Offline
Joined: 16th Apr 2003
Location: Metropia
Posted: 11th Jul 2014 20:57
In your code example above, it's not working because you're retrieving the wrong string token.

volume = val(get split word$(1))

if this is your string: volume = 100

The first token is "volume" and the second token is "100". So if you change that 1 to a 2 in the code above, it'll work.

If you don't want to use the split word commands or rely on 3rd party plugin, here's the alternative:




TheComet
17
Years of Service
User Offline
Joined: 18th Oct 2007
Location: I`m under ur bridge eating ur goatz.
Posted: 12th Jul 2014 00:34
My bad, I thought it started at index 0, not 1.

MateiSoft Romania
11
Years of Service
User Offline
Joined: 16th Oct 2013
Location:
Posted: 12th Jul 2014 12:50
Thnak you guys for the help, that resolved my question, thank you a lot again!

Alex Matei CEO
www.alexmatei.com

Login to post a reply

Server time is: 2025-05-15 01:44:08
Your offset time is: 2025-05-15 01:44:08