the black hole 
it all ends here. 
bhC login
name:
pass:
 
home
 
 the black hole's front page. all the latest vb rpg development and vbgaming news, as well as this week's feature rpg project!
articles
 
rpg theory (7)
directx in vb (3)
vb rpg programming (4)
miscellaneous (4)
files
 
rpg / tile engine source (23)
full vb games w/ source (5)
'helper' libraries and utilities (13)
effect samples (5)
miscellaneous (10)
rpg projects
 
 vb rpg projects under development by members of the bhC. show them your support, and check out their games!
message board
 
 a forum to interact with your fellow vb rpg programmers. you do *not* have to be a bhC member to post!
links
 
vb rpg programming (5)
vb gaming (14)
general game programming (6)
vb sites (6)
miscellaneous (2)
general rpg programming (2)
contact
 
 you want to contact the guy behind the black hole? here's where to do it!


 
 


<< Back to Category List

RPG Scripting, Another Approach - page 1
- by Zaei


pages: prev | 1 | next
Welcome. This is my article on using the MS Scripting Engine in YOUR game. If you know VBScript, or JavaScript, you already have at your fingertips, the potential for amazing scripts.

Overview of the Control:
The scripting control (you can add it using the Components menu in VB) allows you to have complete control over your application at run-time. Using the AddObject method puts a reference to the control in your app, and, by using the ExecuteStatement method, you can assign properties, and run methods, or anything else you can think of. You can add Sub-Procedures or functions using the AddMethod command, and then call those procedures later. As you can see, this is a powerful tool for use in games.

Implementation:
In Divinity (Shameless Plug?) I use an actor class to hold all of the graphical parts ofan entity in the game. This calss has a MoveTo method, which allows me to tell that actor to first, rotate until it is facing the correct position, and then to move forward until i reaches that point. So, when i finished that method, I created a new form, that had a scripting control, a text box, and a command button. Simple, Right? Right. Only 3 lines of code in this form. In the Form_Load Event, use the script control's AddObject method, and add the object we want. This method takes in the Object that you want to add, and a unique name for that object, so that you can use it in your script code. In the Command1_Click Event, we have one line of code, that looks like this:

Scripter.ExecuteStatement Text1.Text

That right there is the code that we use to create a front end for our scripting engine. Back to that MoveTo method. I have our actor set up to be positioned right near our camer, so that we can see it. When I first run the application, that actor is set up to roam around the map, not doing anything. Since the MoveTo method automatically sets our actor to Moving, we can just fire that command right off. In the text box, I type:

Actor.MoveTo 1,1

And Voila! Our actor rotates, and zooms away in the right direction!

Conclusion:
I hope that this article has helped you understand the basics of the Script Control, and has put some creative thoughts into your heads.

Have fun, and enjoy!


pages: prev | 1 | next