Jump to content

Working on a game script.. need advice


Recommended Posts

Ive taken a few classes on Entry level programming, and one class on virtual basic. I understand some basic scripting techniques and can write simply programs.

I play a game, Star wars galaxies, and we have a profession - entertainer- that is only used to buff up combat professions for combat.

I have been attempting to write a program that would do this afk - so we wouldnt hvae to dual log characters anymore. It has turned into quite a challenge so i am curious how some of you more experienced programmers would go about this.

Right now - I have it setting coordinates to via user input at the start of the program.

I have it enable a chatlog text file - that records all chat via the entertainer and the person needed buffed. At the end of the conversation, i have it turn the chatlog off. Which creates a text file in the SWG directory.

I next have a few variables that i store the contents of the text file into.

I run a simple case statement on the variable - example:

If it says jedibuff - perform Function jedibuff() which is a preprogrammed buff.

If the user says medbuff - it performs function medbuff() - another preprogrammed buff.

It is rather buggy- as the variables and chatlog i use i think are not the best method to perform this.

Is there a way to store the entire contents of the file into a variable? FileRead(*\chatlog.text)

Also - would there be a way to customize the entertainer buff via chat input from the combatant. for example:

the combatant can chooose from 20 points the entertainer"buff" provides.

Here is an example :

5 kinetic (5 points)

2 Second Chance or 12% second chance(4 points)

Action Cost Redction (5 points)

Agility (5 points)

Precision (1 points)

The entertainer would say," What buff would you like?"

The combatant would say," Kinetic 5, second chance 12%, Action Reduction, Agility 5, Precision 1"

Then the script would exrtract those variables and combine it into a function.

As of right now i have a function for each Part of the Buff - and its called via pre programmed settings.

Here is the part of the script giving me some problems.

Func ReadLog()

FileDelete("C:\Program Files\StarWarsGalaxies\profiles\user\server\*_chatlog.txt")

MouseMove($targx, $targy)

Sleep(200)

Send("{ENTER}")

Sleep(200)

Send("/log")

Sleep(200)

Send("{ENTER}")

Sleep(200)

Send("{ENTER}")

Sleep(200)

Send("/tt Which buff would you like today?")

Sleep(200)

Send("{ENTER}")

Sleep(15000)

Send("{ENTER}")

Sleep(200)

Send("/log")

Sleep(200)

Send("{ENTER}")

Sleep(200)

$search = FileFindFirstFile("C:\Program Files\StarWarsGalaxies\profiles\user\server\*_chatlog.txt")

If $search = -1 Then

TellError()

Return False

EndIf

$filename = FileFindNextFile($search)

FileClose($search)

$file = FileOpen("C:\Program Files\StarWarsGalaxies\profiles\user\server\" & $filename, 0)

$line = FileReadLine($file)

$line = FileReadLine($file)

$line = FileReadLine($file)

$line = FileReadLine($file)

$line = FileReadLine($file)

$line = FileReadLine($file)

$line = FileReadLine($file)

FileClose($file)

If @error = -1 Then

TellError()

Return False

EndIf

If StringInStr($line, "jedibuff1") Then

Return "jedibuff1"

EndIf

If StringInStr($line, "jedibuff2") Then

Return "jedibuff2"

EndIf

If StringInStr($line, "jedibuff3") Then

Return "jedibuff3"

EndIf

If StringInStr($line, "medbuff1") Then

Return "medbuff1"

EndIf

If StringInStr($line, "medbuff2") Then

Return "medbuff2"

EndIf

If StringInStr($line, "medbuff3") Then

Return "medbuff3"

EndIf

If StringInStr($line, "bhbuff1") Then

Return "bhbuff1"

EndIf

Return False

EndFunc

Here is an example of where they are calling the buffs:

Func JediBuff() ; jedibuff1

Kinetic(5)

Second(2)

Dodge()

Agility(5)

Strength(1)

EndFunc

Func JediBuff2() ; jedibuff2

Energy(5)

Second(2)

Dodge()

Agility(5)

Strength(1)

EndFunc

While 1

; $buff = False

$buff = ReadLog()

Sleep(1000)

if $buff Then

Inspire()

Switch $buff

Case "jedibuff1"

JediBuff()

Case "jedibuff2"

JediBuff2()

Case "jedibuff3"

JediBuff3()

Case "medbuff1"

MedicBuff()

Case "medbuff2"

MedicBuff2()

Case "medbuff3"

MedicBuff3()

Case "bhbuff1"

BountHunterBuff()

Case "grind1"

Grind1()

Case "grind2"

Grind2()

Case "myrickbuff1"

MyrickBuff()

Case "pvpbuff1"

PVPBuff()

Case "exarbuff1"

ExarBuff()

Case Else

TellError()

EndSwitch

Accept()

EndIf

Sleep (1000)

WEnd

Func Agility($amount)

MouseClick ("left", $attribsx, $attribsy, 1)

Sleep (200)

MouseClick ("left", $agilx, $agily, 1)

Sleep (200)

MouseClick ("left", $addx, $addy, $amount)

Sleep (200)

MouseClick ("left", $attribsx, $attribsy, 1)

Sleep (500)

EndFunc

Func Energy($amount)

MouseClick ("left", $resistx, $resisty, 1)

Sleep (200)

MouseClick ("left", $energyx, $energyy, 1)

Sleep (200)

MouseClick ("left", $addx, $addy, $amount)

Sleep (200)

MouseClick ("left", $resistx, $resisty, 1)

Sleep (500)

EndFunc

any help is appreciated I am having a problem debugging the script as it stands. It seems to work ok on my desktop program, however on my laptop - i think lag is an issue - it works about 1/5 times.

Im thinking a variable that would hold the entire contents of the chatlog, rather than storing the first few lines of it - and then a string expression that would extract the keywords (kinetic, agility, etc) and their values then combine them into a function.

How would you combine the customized "buffs" from the chatlog if you were programming this.?

Link to comment
Share on other sites

*rubs eyes*

Can you please put [ autoit ] [ /autoit ] tags around it. I made it about 1/3 the way down before my eyes started to go crosseyed and bleed :) I'd like to try to help you. I used to play SWG about 3 years ago. I sold my Jedi for 1,200 on ebay. I was the 4-5-6th to unlock on the server -- I forget so much as it was 3 years or so ago. I was on Scylla server though. I used AutoIt back then for the crafting professions and to dance -- before the dancers got all these new moves and stuff though. buffbots ftw lol

www.abox.orgAvery HowellVisit My AutoIt Websitehttp://www.abox.org
Link to comment
Share on other sites

*rubs eyes*

Can you please put [ autoit ] [ /autoit ] tags around it. I made it about 1/3 the way down before my eyes started to go crosseyed and bleed :) I'd like to try to help you. I used to play SWG about 3 years ago. I sold my Jedi for 1,200 on ebay. I was the 4-5-6th to unlock on the server -- I forget so much as it was 3 years or so ago. I was on Scylla server though. I used AutoIt back then for the crafting professions and to dance -- before the dancers got all these new moves and stuff though. buffbots ftw lol

sorry about that - i will try and seperate the script from the post
Link to comment
Share on other sites

Ive taken a few classes on Entry level programming, and one class on virtual basic. I understand some basic scripting techniques and can write simply programs.

I play a game, Star wars galaxies, and we have a profession - entertainer- that is only used to buff up combat professions for combat.

I have been attempting to write a program that would do this afk - so we wouldnt hvae to dual log characters anymore. It has turned into quite a challenge so i am curious how some of you more experienced programmers would go about this.

Right now - I have it setting coordinates to via user input at the start of the program.

I have it enable a chatlog text file - that records all chat via the entertainer and the person needed buffed. At the end of the conversation, i have it turn the chatlog off. Which creates a text file in the SWG directory.

I next have a few variables that i store the contents of the text file into.

I run a simple case statement on the variable - example:

If it says jedibuff - perform Function jedibuff() which is a preprogrammed buff.

If the user says medbuff - it performs function medbuff() - another preprogrammed buff.

It is rather buggy- as the variables and chatlog i use i think are not the best method to perform this.

Is there a way to store the entire contents of the file into a variable? FileRead(*\chatlog.text)

Also - would there be a way to customize the entertainer buff via chat input from the combatant. for example:

the combatant can chooose from 20 points the entertainer"buff" provides.

Here is an example :

5 kinetic (5 points)

2 Second Chance or 12% second chance(4 points)

Action Cost Redction (5 points)

Agility (5 points)

Precision (1 points)

The entertainer would say," What buff would you like?"

The combatant would say," Kinetic 5, second chance 12%, Action Reduction, Agility 5, Precision 1"

Then the script would exrtract those variables and combine it into a function.

As of right now i have a function for each Part of the Buff - and its called via pre programmed settings.

Here is the part of the script giving me some problems.

Func ReadLog()
    FileDelete("C:\Program Files\StarWarsGalaxies\profiles\user\server\*_chatlog.txt")
    MouseMove($targx, $targy)
    Sleep(200)
    Send("{ENTER}")
    Sleep(200)
    Send("/log")
    Sleep(200)
    Send("{ENTER}")
    Sleep(200)
    Send("{ENTER}")
    Sleep(200)
    Send("/tt Which buff would you like today?")
    Sleep(200)
    Send("{ENTER}")
    Sleep(15000)
    Send("{ENTER}")
    Sleep(200)
    Send("/log")
    Sleep(200)
    Send("{ENTER}")
    Sleep(200)
    $search = FileFindFirstFile("C:\Program Files\StarWarsGalaxies\profiles\user\server\*_chatlog.txt")
    If $search = -1 Then
        TellError()
        Return False
    EndIf
    $filename = FileFindNextFile($search)
    FileClose($search)
    $file = FileOpen("C:\Program Files\StarWarsGalaxies\profiles\user\server\" & $filename, 0)
    $line = FileReadLine($file)
    $line = FileReadLine($file)
    $line = FileReadLine($file)
    $line = FileReadLine($file)
    $line = FileReadLine($file)
    $line = FileReadLine($file)
    $line = FileReadLine($file)
    FileClose($file)
    If @error = -1 Then
        TellError()
        Return False
    EndIf
    If StringInStr($line, "jedibuff1") Then
        Return "jedibuff1"
    EndIf
    If StringInStr($line, "jedibuff2") Then
        Return "jedibuff2"
    EndIf
    If StringInStr($line, "jedibuff3") Then
        Return "jedibuff3"
    EndIf
    If StringInStr($line, "medbuff1") Then
        Return "medbuff1"
    EndIf
    If StringInStr($line, "medbuff2") Then
        Return "medbuff2"
    EndIf
    If StringInStr($line, "medbuff3") Then
        Return "medbuff3"
    EndIf
    If StringInStr($line, "bhbuff1") Then
        Return "bhbuff1"
    EndIf
    Return False
EndFuncoÝ÷ Øw«z+ìZ^¡ü!z·­ì­çX§Ø^nçß±«­¢+ÙÕ¹)¥   Õ ¤ì©¥ÕÄ(%-¥¹Ñ¥ Ô¤(%M½¹ Ȥ(%½ ¤(%¥±¥Ñä Ô¤(%MÑÉ¹Ñ  Ä¤)¹Õ¹()Õ¹)¥    ÕÈ ¤ì©¥ÕÈ(%¹Éä Ô¤(%M½¹ Ȥ(%½ ¤(%¥±¥Ñä Ô¤(%MÑÉ¹Ñ  Ä¤)¹Õ¹()]¡¥±Ä(ì$ÀÌØíÕô±Í($ÀÌØíÕôI1½ ¤(%M±À ÄÀÀÀ¤(%¥ÀÌØíÕQ¡¸($%%¹ÍÁ¥É ¤($%MÝ¥Ñ ÀÌØíÕ($$%
ÍÅÕ½Ðí©¥ÕÄÅÕ½Ðì($$$%)¥  Õ ¤($$%
ÍÅÕ½Ðí©¥ÕÈÅÕ½Ðì($$$%)¥  ÕÈ ¤($$%
ÍÅÕ½Ðí©¥ÕÌÅÕ½Ðì($$$%)¥  ÕÌ ¤($$%
ÍÅÕ½ÐíµÕÄÅÕ½Ðì($$$%5¥    Õ ¤($$%
ÍÅÕ½ÐíµÕÈÅÕ½Ðì($$$%5¥    ÕÈ ¤($$%
ÍÅÕ½ÐíµÕÌÅÕ½Ðì($$$%5¥    ÕÌ ¤($$%
ÍÅÕ½Ðí¡ÕÄÅÕ½Ðì($$$%   ½Õ¹Ñ!Õ¹ÑÉ   Õ ¤($$%
ÍÅÕ½ÐíÉ¥¹ÄÅÕ½Ðì($$$%É¥¹Ä ¤($$%
ÍÅÕ½ÐíÉ¥¹ÈÅÕ½Ðì($$$%É¥¹È ¤($$%
ÍÅÕ½ÐíµåÉ¥­ÕÄÅÕ½Ðì($$$%5åÉ¥­  Õ ¤($$%
ÍÅÕ½ÐíÁÙÁÕÄÅÕ½Ðì($$$%AYA    Õ ¤($$%
ÍÅÕ½ÐíáÉÕÄÅÕ½Ðì($$$%áÉ Õ ¤($$%
ͱÍ($$$%Q±±ÉÉ½È ¤($%¹MÝ¥Ñ ($%ÁÐ ¤(%¹%(%M±À ÄÀÀÀ¤)]¹()Õ¹¥±¥Ñä ÀÌØíµ½Õ¹Ð¤(%5½ÕÍ
±¥¬ ÅÕ½Ðí±ÐÅÕ½Ðì°ÀÌØíÑÑÉ¥Íà°ÀÌØíÑÑÉ¥Íä°Ä¤(%M±À ÈÀÀ¤(%5½ÕÍ
±¥¬ ÅÕ½Ðí±ÐÅÕ½Ðì°ÀÌØí¥±à°ÀÌØí¥±ä°Ä¤(%M±À ÈÀÀ¤(%5½ÕÍ
±¥¬ ÅÕ½Ðí±ÐÅÕ½Ðì°ÀÌØíà°ÀÌØíä°ÀÌØíµ½Õ¹Ð¤(%M±À ÈÀÀ¤(%5½ÕÍ
±¥¬ ÅÕ½Ðí±ÐÅÕ½Ðì°ÀÌØíÑÑÉ¥Íà°ÀÌØíÑÑÉ¥Íä°Ä¤(%M±À ÔÀÀ¤)¹Õ¹()Õ¹¹Éä ÀÌØíµ½Õ¹Ð¤(%5½ÕÍ
±¥¬ ÅÕ½Ðí±ÐÅÕ½Ðì°ÀÌØíÉÍ¥ÍÑà°ÀÌØíÉÍ¥ÍÑä°Ä¤(%M±À ÈÀÀ¤(%5½ÕÍ
±¥¬ ÅÕ½Ðí±ÐÅÕ½Ðì°ÀÌØí¹Éåà°ÀÌØí¹Éåä°Ä¤(%M±À ÈÀÀ¤(%5½ÕÍ
±¥¬ ÅÕ½Ðí±ÐÅÕ½Ðì°ÀÌØíà°ÀÌØíä°ÀÌØíµ½Õ¹Ð¤(%M±À ÈÀÀ¤(%5½ÕÍ
±¥¬ ÅÕ½Ðí±ÐÅÕ½Ðì°ÀÌØíÉÍ¥ÍÑà°ÀÌØíÉÍ¥ÍÑä°Ä¤(%M±À ÔÀÀ¤)¹Õ¹

any help is appreciated I am having a problem debugging the script as it stands. It seems to work ok on my desktop program, however on my laptop - i think lag is an issue - it works about 1/5 times.

Im thinking a variable that would hold the entire contents of the chatlog, rather than storing the first few lines of it - and then a string expression that would extract the keywords (kinetic, agility, etc) and their values then combine them into a function.

How would you combine the customized "buffs" from the chatlog if you were programming this.?

**sorry it wouldnt let me edit the first post

Link to comment
Share on other sites

From what ive seen

"$line = FileReadLine($file)

1 $line = the last line read from $file

why? because u didnt do &=

for it to save all that info in $line u need to do

$line = FileReadLine($file)

$line &= FileReadLine($file)

$line &= FileReadLine($file)

$line &= FileReadLine($file)

$line &= FileReadLine($file)

$line &= FileReadLine($file)

$line &= FileReadLine($file)

or just read the hole file cause thats what it looks like its doing

that is why its missing some commands i think

for proformance i would probly delete the txt files some how after they have been used and to keep the folder clean :)

hope that helps

Link to comment
Share on other sites

  • 3 weeks later...

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...