Decal Development Forums Forum Index Decal Development Forums
www.decaldev.com
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Using Prolog with VB 6.0

 
Post new topic   Reply to topic    Decal Development Forums Forum Index -> AC FAQ's and Howtos (Archive)
View previous topic :: View next topic  
Author Message
Zyrca



Joined: 19 Apr 2002
Posts: 219
Location: MA

PostPosted: Tue Jun 17, 2003 8:52 am    Post subject: Using Prolog with VB 6.0 Reply with quote

First, you will need to get Amzi! Prolog + Logic Server, which can be obtained at the Amzi! site. You will want the personal license, which is free and you may distribute plugins that you have created with it. You may not charge for these plugins though, unless you want to cough up $1000+.

The first thing you will need to do is write some Prolog rules. If you don't know Prolog then I recommend going through at least this short tutorial on prolog before you begin. Later you may wish to go through this longer tutorial on Prolog which goes through creating an adventure game. Open up the Amazi IDE and write down a rules or two. A very simple rule may be:

hello(vb, prolog).

Hit the CMP button or go under Build/Compile... to compile your file. Next hit the LNK button or go under Build/Link... and choose the .plm version of your file.

Now, open up your Visual Basic project for your plugin and add amzi.bas to your modules. On a standard installation, this can be found at C:\\Program Files\\amzi_6-2-14\\lsapis\\vb\\amzi.bas. Next, put the amzi.dll file somewhere that Visual Basic can find it. amzi.dll can be found at C:\\Program Files\\amzi_6-2-14\\bin\\amzi.dll, I put mine in C:\\WINDOWS\\system32.

Now, put this code somewhere that it will be run (such as the login event)

Code:
' rc is used for functions that return an error code
' tf is for functions that return true/false (success/failure)
Dim rc As Integer, rc2 As Integer, tf As Integer
Dim s As String, xpl As String, errmsg As String
' term is actually a pointer, but we use longs in VB
Dim Term As Long

Call AmziLogicServer?.InitLS("")
wtcw "Prolog Initialized"
Call AmziLogicServer?.LoadLS(App.Path & "yourprologfile.xpl")
wtcw "BuffChooser.xpl Loaded"

tf = AmziLogicServer?.CallStrLS(Term, "hello(vb, What)")
' Loop while the term can be unified
If (tf) Then
    ' The cover functions:
    ' (1) make room for the Amzi engine to return a string
    '     (the size is controlled by SetMaxStrLenLS) and
    ' (2) pass all such strings using ByVal
    Call GetArgLS(Term, 2, bSTR, s)
    ' Display the second argument
    wtcw "Result: " & s
End If



If all goes well, you can now use prolog in your plugin!
_________________
-Zyrca
Back to top
View user's profile Send private message Visit poster's website
-beef-



Joined: 11 Jul 2003
Posts: 5

PostPosted: Thu Jul 17, 2003 10:58 am    Post subject: Reply with quote

i ahve read thru the tuturals for this, but i dont get how it would be helpfull in a plugin, but i'm a noob

can someone inlighten me
Back to top
View user's profile Send private message
pendergas_t
Guest





PostPosted: Thu Jul 15, 2004 4:52 pm    Post subject: Reply with quote

heh, scripting maybe? Smile
Back to top
Display posts from previous:   
Post new topic   Reply to topic    Decal Development Forums Forum Index -> AC FAQ's and Howtos (Archive) All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group