Skip to main content
gamedev.net
🔒 Locked

Script Code Editor - VB6

Started by Prozak May 18, 2002 at 9:09 PM 2 replies 250+ views
Original Post
Prozak
Prozak
Hi all, i''m trying to do a small script editor in VB, to edit scripts for the AI in my game. I wanted to be able to change the text color for keyword, like "if" "while" "double", etc... I also wanted an intellisense and dictionary option, but for this, a special window must appear right below the place the cursor is at. So if im writing function alphabeta, and i''m in the middle of the word, he should present the "alphabeta" option right below, for me to choose. Something like automatic url completion in browsers. Hope someone can point me in the right direction,

[Hugo Ferreira][Positronic Dreams][]
"Somewhere, something incredible is waiting to be known."
- Carl Edward Sagan (1934 - 1996)

felonius
felonius
What you need to do is to parse the script while you edit it, build a parse tree and then use this parse tree to guess what the user is typing and to color the keywords (and variables, comments, etc.)

If this advice doesn''t make sense to you I recommend that you read a book on compiler construction theory. My own favourite is the "Dragon book":

Aho, Sethi, Ullman: Compilers - Principles, Techniques and Tools.

Writing a parser, interpreter/compiler is much easier with this theory in place and you will need it anyway when you try to actually make your script run.
Jacob Marner, M.Sc.Console Programmer, Deadline Games
psyberia
psyberia
Take a look at freevbcode.com and search for color coding. I believe they had a code snippet for that. They might also have something for intellisense.
~"What''s this red button do?"

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.