Sign in to follow this  
Followers 0
spex

Translate from Visual Basic

7 posts in this topic

#1 ·  Posted (edited)

Hello!

I have made a code in visual basic before, and now I want it in one of my autoit-scripts.

I haven't coded long enought to be able to translate the code.

If you want to translate it for me, I know the code won't be exectly the same, because it's two diffrent languages. If it works, I would be really happy :D

Type Kort_typ
  Valör As Integer
  Färg As Integer
End Type

Public valörerna(1 To 14) As Integer
Public färgerna(1 To 4) As Integer
Public Community(1 To 5) As Kort_typ
Public Player1(1 To 2) As Kort_typ

Public TempHand(1 To 7) As Kort_typ

TempHand(1) = Player1Card(1)
TempHand(2) = Player1Card(2)

TempHand(3) = CC(1)
TempHand(4) = CC(2)
TempHand(5) = CC(3)

For i = 1 To 7
    With TempHand(i)
        valörerna(.Valör) = valörerna(.Valör) + 1
        If .Valör = 14 Then valörerna(1) = valörerna(1) + 1
    End With
Next i

For i = 1 To 7
    With TempHand(i)
        färgerna(.Färg) = färgerna(.Färg) + 1
    End With
Next i

For i = 2 To 14
    If valörerna(i) = 2 Then Par = Par + 1
    If valörerna(i) = 3 Then Triss = True
    If valörerna(i) = 4 Then Fyrtal = True
Next i

For i = 1 To 10
    If valörerna(i) = 1 And valörerna(i + 1) = 1 And valörerna(i + 2) = 1 And valörerna(i + 3) = 1 And _
    valörerna(i + 4) = 1 Then
        Stege = True
        Exit For
    End If
Next i

For i = 1 To 7
    If valörerna(i) >= 5 Then
        Färg = True
        Exit For
    End If
Next i
Edited by spex

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

In English might help...

Search the forums... there is a VBScript to AutoIt (or it might be VBA to AutoIt) not sure.

VBScript to AutoIt Converter

Also with the AutoIt COM architecture the translation is quite easy.

Edit: Added link.

I hope this helps some,

JS

Edited by JSThePatriot

AutoIt Links

File-String Hash Plugin Updated! 04-02-2008 Plugins have been discontinued. I just found out.

ComputerGetInfo UDF's Updated! 11-23-2006

External Links

Vortex Revolutions Engineer / Inventor (Web, Desktop, and Mobile Applications, Hardware Gizmos, Consulting, and more)

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

OK thanks, will check it out.

I didn't translate the code into english because it's just variables.

*Edit*

Hmm, my code wasn't in VBScript, so it didn't help very much.

But I can make my question easyer I think.

Autoit doesn't use "Types" huh?

And that is the problem I got in the translation.

Can anyone make a suggestion of what I should do instead of making my own types?

Edited by spex

Share this post


Link to post
Share on other sites

If you are using the beta version of AutoIt you might want to take a look at the DllStruct functions.

Share this post


Link to post
Share on other sites

I guess I don't use a beta.

Stop talking in riddles :D

Just say what I should do.. implant vb-code into a autoit script would be nice.

Share this post


Link to post
Share on other sites

Explain what your VB code does. I dont have a clue what its doing... If we knew that we could certainly direct you in a direction of recreation.

I understand you are wanting conversion, but it would be a start.

Also did you even run the VBScript to AutoIt? It should translate some of the items for you and give you an idea on how to do the rest for you. No one here really likes giving the complete solution. We want to make sure everyone understands what is going on as it will better the majority. There are plenty of times that if asked, the right people we will write scripts, but generally we try to keep from doing so.

I hope some of the above solutions may benefit you.

JS


AutoIt Links

File-String Hash Plugin Updated! 04-02-2008 Plugins have been discontinued. I just found out.

ComputerGetInfo UDF's Updated! 11-23-2006

External Links

Vortex Revolutions Engineer / Inventor (Web, Desktop, and Mobile Applications, Hardware Gizmos, Consulting, and more)

Share this post


Link to post
Share on other sites

As I said, my code isn't VBscript. It's written in VB6.

I guess I could rename my code from

example.bas -> example.vbs

and then see what I get.

Ok, here is what the code does:

This is an algoritm to check the points in a Poker game.

It puts your card (on your hand) and the cards on the table (community cards) into a vector ( TempHand ).

And then checks if the "TempHand" has anything that is worth anything..

__Points__

Par = Pair

Triss = Three of a kind

Stege = Straight

Färg = Color

__Type Kort_Typ__

Valörerna = Hmm, the numbers on the cards

Färg = Color (as I said)

I don't know if this is to any help, I will try to write a whole new code and stuff, but i'm in a bit of a hurry.

And no, I don't want the complete solution, just some guidelines.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0