Jump to content

Translate from Visual Basic


spex
 Share

Recommended Posts

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
Link to comment
Share on other sites

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)

Link to comment
Share on other sites

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
Link to comment
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)

Link to comment
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.

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...