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 Discussion / Loading Code from a Text File

Author
Message
Jimi
21
Years of Service
User Offline
Joined: 14th Sep 2003
Location:
Posted: 21st Jan 2004 20:12
Is it possible to load code from a text file, so that the code IN the text file is followed as if it were actually in the program at that point? Do I make sense?

PiratSS
22
Years of Service
User Offline
Joined: 18th Oct 2002
Location:
Posted: 21st Jan 2004 20:25
I don't think that's possible in DBC.

Dual AMD Athlon MP 2x1GHZ | IBM 15000Rpm SCSI 73.4 Gb X 2 | e-GeForce Ti4400 | Audigy 2 + 7.1 Surround sound | 17' Monitor | Ugly mouse
ReD_eYe
22
Years of Service
User Offline
Joined: 9th Mar 2003
Location: United Kingdom
Posted: 21st Jan 2004 22:00
don't think its even possible in dbpro


GO TO THE ETERNAL DESTINY FORUMS!!! http://forums.eternaldestinyonline.com
Do it now!!!
DBellis82
21
Years of Service
User Offline
Joined: 19th Jan 2004
Location:
Posted: 21st Jan 2004 22:37
you would need to write a parser so every command u want
would need to be read then exe'ted inside the exe i.e.

Psudo code

Load my object "bob.x" ` inside the text file

open the file
read the string
check if its a valid command
exe that command
get next line
if nomore lines = 1 then end loop
close the file

Codeing Makes Your Mrs hate You
STB Devolper - [url]www.eclipsedevelopment.co.uk[/url]
Travis
21
Years of Service
User Offline
Joined: 9th Nov 2003
Location: West Aust.
Posted: 22nd Jan 2004 08:48
but u cant do the
Quote: "exe that command"
part rendering it impossible...unless u knew the format a exe was saved as then went:

open the file
read the string
check if its a valid command
save it to an exe file
if nomore lines = 1 then end loop
close the file
run the exe


but making a valid win32 aplication thro the equivilent of typeing text in a word file and nameing is .exe.. is kinda hard...
hexGEAR
22
Years of Service
User Offline
Joined: 3rd Nov 2002
Location: Naytonia
Posted: 22nd Jan 2004 12:31 Edited at: 22nd Jan 2004 12:31
i guess you could decipher the contents of the text file? kinda like make db in db

you open to read, read each into a string, analyse the string and find what commands it contains, execute the command, etc

Travis
21
Years of Service
User Offline
Joined: 9th Nov 2003
Location: West Aust.
Posted: 22nd Jan 2004 12:46
yeah like read the word and see if its move object then when it goes outa the loop it says in string one = 5 then move object ect
it is posible i guess
DBellis82
21
Years of Service
User Offline
Joined: 19th Jan 2004
Location:
Posted: 22nd Jan 2004 17:53
thats exactly wot i ment hehe sorry if my dodgy pusado code
confused you hehe but i dont normaly right it.

Damian

Codeing Makes Your Mrs hate You
STB Devolper - [url]www.eclipsedevelopment.co.uk[/url]
Travis
21
Years of Service
User Offline
Joined: 9th Nov 2003
Location: West Aust.
Posted: 23rd Jan 2004 04:21
im gunan try that now...tho its alot of effort, you could use it for like update file for say the computer ai or somthing, what r ur plans for it?
Phaelax
DBPro Master
22
Years of Service
User Offline
Joined: 16th Apr 2003
Location: Metropia
Posted: 23rd Jan 2004 09:51
My string tokenizer would make parsing that text file very simple.

"eureka" - Archimedes
hexGEAR
22
Years of Service
User Offline
Joined: 3rd Nov 2002
Location: Naytonia
Posted: 24th Jan 2004 00:40
it would get pretty hardcore if you declare variables in the .txt file, say you had:

x = x + 1
print x

you would have to have reserved variables to replace the variables in the text file, you will aslo have to know each and every variable in the text file.

good luck, if you succeed your one step closer to making your own script language and interpreter.

Angel Lazerus
21
Years of Service
User Offline
Joined: 8th Feb 2004
Location:
Posted: 9th Feb 2004 02:00
Has anyone actually tried any scripting with DB?
I need to make a script system for my RPG for cut scenes and event triggers so any advice or tales of experience in this would be a help.

Thanks,
Angel. X
Crappy Coder
21
Years of Service
User Offline
Joined: 16th Sep 2003
Location: Uk, Bath
Posted: 9th Feb 2004 02:04
hehe yeah uwdesign has done some very crazy things with db!!

you should pop along to these db/dbpro/any forums:

http://www.dannywartnaby.co.uk/rgt/

Login to post a reply

Server time is: 2025-05-22 19:38:02
Your offset time is: 2025-05-22 19:38:02