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 / Another question about "how execute a code in a darkbasic program"

Author
Message
print TheGourglex
13
Years of Service
User Offline
Joined: 24th Dec 2012
Location:
Posted: 2nd Mar 2013 11:56
Hello.
I know that i already asked that question before...but i find other way to say (or write...)
Suppose I have a .txt file with this code:

And i have this db code:

What i want is execute the .txt file in the db code, without me having to copy and paste the code! So...i want to run an external file!
I thought in this form: in the db code i'ld creat a 'select' with all the db codes, and load each word in array and execute this codes in a loop. But...appeared this questions:
- is there another and easier way?
- how i'ld execute the condition 'if' in the select?
I already thank you for the help!
Giornni Paolinelli

"Better than do is try"
Brendy boy
20
Years of Service
User Offline
Joined: 17th Jul 2005
Location: Croatia
Posted: 2nd Mar 2013 14:06
you need to use LUA scripting language

print TheGourglex
13
Years of Service
User Offline
Joined: 24th Dec 2012
Location:
Posted: 2nd Mar 2013 14:26
Can you give me an example?
What plugins did i need to instal?

"Better than do is try"
Brendy boy
20
Years of Service
User Offline
Joined: 17th Jul 2005
Location: Croatia
Posted: 2nd Mar 2013 14:43
have a look at this thread under the letter "L"

Rudolpho
20
Years of Service
User Offline
Joined: 28th Dec 2005
Location: Sweden
Posted: 4th Mar 2013 22:11 Edited at: 4th Mar 2013 22:15
If you're interested in doing it yourself, look into parsing and script interpretation.
It will be a mess to accomplish in DBP code but I see no reason why it wouldn't be possible. Actually I think TechLord did this a while ago, search the boards for DarkMachine or something like that

Edit: Thread link.
It seems his project was more of a precompiler to assembler code though. The ideas are still pretty much the same even if you want to just interpret the scripts from within your own code and run it straight from there (without requiring intermediary compilation).


"Why do programmers get Halloween and Christmas mixed up?"

Login to post a reply

Server time is: 2026-07-07 06:24:40
Your offset time is: 2026-07-07 06:24:40