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 / Passing a value from FPI to DarkBasic FPSC source?

Author
Message
MiRRoRMaN 64
22
Years of Service
User Offline
Joined: 11th Jan 2004
Location:
Posted: 23rd May 2013 01:54
Hi,

I'm looking for ways to put a value in one of my FPI's, in example "music=1" or "mp3=tunename1.mp3" and then have that passed to the DarkBasic Pro FPSC source so it can do something with that value.

How does this source handle and parse the FPI's and how would I pass such a value? Also, whats the best location to put such code in the FPSC source?

Thank you in advance!
Section 812
18
Years of Service
User Offline
Joined: 24th Feb 2008
Location:
Posted: 23rd May 2013 05:25 Edited at: 23rd May 2013 08:19
if your talking about adding new commands to FPSC's scripting language :

global playmusic#=0

#constant AIACTMUSIC 1658

actword$(AIACTMUSIC)="music"

case AIACTMUSIC:
playmusic# = aiactionseq(seq).value
if playmusic#=1 then 'do something'
endcase

you'll have to find the appropriate place for each line.
the best thing to do is to study the source, every thing you need to know is in it.

MiRRoRMaN 64
22
Years of Service
User Offline
Joined: 11th Jan 2004
Location:
Posted: 23rd May 2013 16:27
I tried what you said but this makes the compiled source crash somehow. Like it compiles, it runs, but it crashes?
Section 812
18
Years of Service
User Offline
Joined: 24th Feb 2008
Location:
Posted: 23rd May 2013 18:28
If you could give a little more info on what your doing or show some code, I could help better.

a few things to look at are:

#constant AIACTMUSIC 1658 - where I have 1658, this number should be in sequence with the other numbers, like if the last number was 1657.
make sure it's not after #constant AIACTLAST.

playmusic# = aiactionseq(seq).value - if you are trying to pull in a string then this value would be "aiactionseq(seq).string1"
if you are trying to pull in a file name then it would be "aiactionseq(seq).filename"

so in your case for a mp3 file:
case AIACTMP3:
mfile$=aiactionseq(seq).filename
if file exist(mfile$)=1
addfiletocollection(mfile$) rem adds file to build game
"then do what you need to do with it"
endif
endcase

there are already music and sound commands available in FPSC, you might search the source for them and see how their done.

MiRRoRMaN 64
22
Years of Service
User Offline
Joined: 11th Jan 2004
Location:
Posted: 23rd May 2013 23:47
Yeah haha the music thing was just an example even though I have been thinking of maybe (maybe) adding my own music routine given that it would maybe run lighter or whatever. Can't be too sure about that though since I noticed the latest versions of FPSC are beautifully optimized and way smoother than previous versions.

I have to thank you though Section 812 you helped me solve this rubics cube. Its working now. I tested it with some test code and its working BEAUTIFULLY.

Particularly this tip was a great help:

Quote: "make sure it's not after #constant AIACTLAST."


This seems to be of vital importance because if you put it anywhere outside that your FPSC WILL crash. I'm repeating this in this tread for people who might be searching for it.

So thank you again, its working great now!

Login to post a reply

Server time is: 2026-07-07 11:47:06
Your offset time is: 2026-07-07 11:47:06