Jump to content

Randomize with specific percentage


Recommended Posts

I want to make something like opening lucky packs, but the contents of the packs are fixed like for example :

Opening Lucky Pack A will give one of these items with fixed chances in percentage

- Candy (90%)

- Hamburger (4%)

- Hot Dog (4%)

- Fried Chicken (1%)

- iPhone (0.4%)

- iPad (0.4%)

- Laptop (0.1%)

- Motorcycle (0.07%)

- Car (0.02%)

- Small House (0.009%)

- Big House (0.001%)

If we add all those chances, it will be equal to 100%.

 

My idea is to just randomize integer from 1 to 100000 then put the function onto a button and when the button is clicked if the number appears is :

1 to 90000 then the prize is candy

90001 to 94000 the prize is Hamburger

94001 to 98000 the prize is Hot Dog

98001 to 99000 the prize is Fried Chicken

99001 to 99400 the prize is iPhone

99401 to 99800 the prize is iPad

99801 to 99900 the prize is Laptop

99901 to 99970 the prize is Motorcycle

99971 to 99990 the prize is Car

99991 to 99999 the prize is Small House

100000 the prize is Big House

It seems right to me but I'm open to other methods because I'd like to customize the chances and the items in an ini file , so I can make and add as many customizable Lucky Packs easier by just creating new ini files and edit it.

 

The only randomize I know from AutoIT is by using Random(). Is there any easier method to make this ?

 

 

 

Edited by Smurfin
Link to comment
Share on other sites

This example randomly fills an array with 100,000 prizes.  

So for a 0.001% selection chance there is one (1) prize in 100000.  
For a 0.009% selection chance there is nine (9) prizes in 100000.
For a 90% selection chance there is ninety thousand (90,000) prizes in 100000.

And each prize is randomly placed in the 100,000 element array.

Note: _ArrayDisplay() only displays 65525 elements of a large array. The array itself does contain 100,000 elements.

#include <Array.au3>

Local $aArr = [["Big House", 1],["Small House", 9],["Car", 20],["Motorcycle", 70],["Laptop", 100],["iPad", 400], _
        ["iPhone", 400],["Fried Chicken", 1000],["Hot Dog", 4000],["Hamburger", 4000],["Candy", 90000]]
Local $PrizeNumber[100000], $iRnd

; Randomly fill the $PrizeNumber array with prizes except for the last item Candy.
For $i = 0 To UBound($aArr) - 2
    For $j = 1 To $aArr[$i][1]
        Do
            $iRnd = Random(0, 99999, 1)
        Until $PrizeNumber[$iRnd] = ""
        $PrizeNumber[$iRnd] = $aArr[$i][0]
        ($i <= 3) ? ConsoleWrite($iRnd & @TAB & $aArr[$i][0] & @TAB & "Chance " & (100 * $aArr[$i][1] / 100000) & "%" & @LF) : "" ; Show Top 4 prizes winning numbers
    Next
Next

; Remaining blank array elements are Candy 90,000 of them
Local $sLastItem = $aArr[UBound($aArr) - 1][0]
For $i = 0 To UBound($PrizeNumber) - 1
    If $PrizeNumber[$i] = "" Then $PrizeNumber[$i] = $sLastItem
Next
_ArrayDisplay($PrizeNumber)

; Example - Random Draw 50 prizes
Local $sRes
For $i = 1 To 50
    $iRnd = Random(0, 99999, 1)
    $sRes &= "#" & $i & @TAB & $PrizeNumber[$iRnd] & @TAB & "  Rnd Number " & $iRnd & @CRLF
Next
MsgBox(0, "Random Draw", $sRes)

 

Link to comment
Share on other sites

Errrm, :blink: maybe waste a little bit less memory?;) Like so (hardcoded):

Srandom(@MSEC+@AutoItPID)
While True
    if MsgBox(1,"Prize",_Prize())=2 then Exit
Wend


Func _Prize()

    Switch random(1,100000,1)
        Case 1 to 90000
            Return "Candy"
        Case 90001 to 94000
            Return "Hamburger"
        Case 94001 to 98000
            Return "Hot Dog"
        Case 98001 to 99000
            Return "Fried Chicken"
        Case 99001 to 99400
            Return "iPhone"
        Case 99401 to 99800
            Return "iPad"
        Case 99801 to 99900
            Return "Laptop"
        Case 99901 to 99970
            Return "Motorcycle"
        Case 99971 to 99990
            Return "Car"
        Case 99991 to 99999
            Return "Small House"
        Case 100000
            Return "Big House"
    EndSwitch

EndFunc

Or soft-coded with a tiny array, like so:

#include <Array.au3>

Srandom(@MSEC+@AutoItPID)
Global $chanceOfNoPrize=0

; you could load this array from an external text file or .ini too
Global $Prizes[12][2] = [[0,0], _
    ["Candy", 90000], _
    ["Hamburger",4000], _
    ["Hot Dog",4000], _
    ["Fried Chicken", 1000], _
    ["iPhone",400], _
    ["iPad",400], _
    ["Laptop",100], _
    ["Motorcycle",70], _
    ["Car",20], _
    ["Small House",9], _
    ["Big House",1]]

$Prizes[0][0]=UBound($Prizes)-1
For $rc=2 To $Prizes[0][0]
    $Prizes[$rc][1]+=$Prizes[$rc-1][1]
Next
$Prizes[0][1]=$Prizes[$rc-1][1]
_ArrayDisplay($prizes)


While True
    if MsgBox(1,"Prize",_Prize())=2 then Exit
Wend


Func _Prize()

    Local $pick=Random(1,$Prizes[0][1]+$chanceOfNoPrize,1)

    For $rc=1 to $Prizes[0][0]
        if $pick<=$Prizes[$rc][1] then Return $Prizes[$rc][0]
    Next

    Return "No Prize"
EndFunc

Of course, the external chance of no prize could also be incorporated into the main list.:)

Link to comment
Share on other sites

I did not throw this into an INI file yet but I designed it so that it could be pretty easy.

 

Your INI would need to contain the # of Items and then the list of items and the % to win (Whole Numbers Adding up to 100)

#Include <Array.au3>

;Number of Items
Global $iItemCount = 5

;Item List & Percenteges
Global $aValue[$iItemCount][3]

$aValue[0][0] = "Item 1"
$aValue[1][0] = "Item 2"
$aValue[2][0] = "Item 3"
$aValue[3][0] = "Item 4"
$aValue[4][0] = "Item 5"

$aValue[0][1] = 5
$aValue[1][1] = 15
$aValue[2][1] = 30
$aValue[3][1] = 10
$aValue[4][1] = 40

;Copy first percentage over to value column
$aValue[0][2] = $aValue[0][1]

;Add values to get our winning (percent) range
For $i = 1 to $iItemCount -1
    $aValue[$i][2] = $aValue[$i][1] + $aValue[$i-1][2]
Next

;Generate our random winning number
$iRandom = Random(1, 100)

; MsgBox(0, "", $iRandom) ;Unquote if you want to see the Winning Range
; _ArrayDisplay($aValue) ;Unquote if you want to see the full array generated

MsgBox(0, "", _Draw())

Func _Draw()
    For $i = 0 to $iItemCount
        If $i = 0 Then
            If $iRandom < $aValue[0][2] Then Return $aValue[0][0]
        Else
            If $i = $iItemCount Then Return $aValue[$i][0]
            If $iRandom > $aValue[$i-1][2] AND $iRandom < $aValue[$i][2] Then Return $aValue[$i][0]
        EndIf
    Next
EndFunc

 

Link to comment
Share on other sites

This is my c:\tmp\prizes.tsv: (note: tab-separated, forum seems to convert that to spaces :( !)

Quote

90000    Candy
94000    Hamburger
98000    Hot Dog
98001    Fried Chicken
99400    iPhone
99800    iPad
99900    Laptop
99970    Motorcycle
99990    Car
99999    Small House
100000    Big House

 

This is my attempt (again, there's a TAB in the stringsplit line):

$file = "c:\tmp\prizes.tsv"

$diceRoll = Random(0, 100000, 1)

For $line In FileReadToArray($file)
    If $diceRoll <= StringSplit($line, "    ", 2)[0] Then
        MsgBox(64, "found", $diceRoll & " wins you: " & StringSplit($line, "    ", 2)[1])
        ExitLoop
    EndIf
Next

 

Edited by SadBunny
shorter :)

Roses are FF0000, violets are 0000FF... All my base are belong to you.

Link to comment
Share on other sites

A onelinerish solution, just because I like them :)

(Same test file as above but then separated by pipes and called prizes.psv, because it's easier to deal with pipes than with tabs for these purposes.)

$diceRoll = Random(0, 100000, 1)
For $line In FileReadToArray("c:\tmp\prizes.psv")
    If ($diceRoll <= StringSplit($line, "|", 2)[0] And MsgBox(64, "found", $diceRoll & " wins you: " & StringSplit($line, "|", 2)[1])) Then ExitLoop
Next

 

Roses are FF0000, violets are 0000FF... All my base are belong to you.

Link to comment
Share on other sites

The actual packs I'm going to simulate are from Perfect World MMO game, there are a lot of packs and here below are examples of them, there are various items and chances in each

http://www.pwdatabase.com/pwi/quest/34010

http://www.pwdatabase.com/pwi/items/42202

 

there is one item with (0.0005%), that's  0.000005 , so many zeros, if using array do you think 1 million arrays are gonna work ?

Simulating x% chance like that using randomized number is correct, right ? it's still gonna be x% that way.

I'll design about how the GUI would be like and use the example you guys gave later on, it's gonna be using icons too, like in that link, so the ini file would contain how many items in the packs, the icon file, chances, and names. I'd also like to count how many packs opened until xxxxxxxxxx item appears, manual and automatically so I'd know the odds.

Thanks again.

 

 

 

 

Edited by Smurfin
Link to comment
Share on other sites

Local $aRand = [ ["Candy", 90], _
                 ["Hamburger", 4], _
                 ["Hot Dog", 4], _
                 ["Fried Chicken", 1], _
                 ["iPhone", 0.4], _
                 ["iPad", 0.4], _
                 ["Laptop", 0.1], _
                 ["Motorcycle", 0.07], _
                 ["Car", 0.02], _
                 ["Small House", 0.009], _
                 ["Big House", 0.001]]

Local $sRandomItem = _RandomPercent($aRand)
ConsoleWrite("Random item : " & $sRandomItem)

Func _RandomPercent($aRandPercents)
    Local $iPercent = 0, $iRand = Random(1, 100)
    ConsoleWrite("Random value : " & $iRand & @CRLF)
    For $i = 0 To UBound($aRandPercents) - 1
        $iPercent += $aRandPercents[$i][1]
        If $iRand <= $iPercent Then
            Return $aRandPercents[$i][0]
        EndIf
    Next
EndFunc

@RTFC : it seems we had the same idea...

Link to comment
Share on other sites

Note that @jguinch 's method is very much dependent on the chances combined being exactly equal to 100. If lower, then resulting item may be 0, if higher, the item that first makes the total cross a 100 will not be chosen frequently enough and any beyond that not at all. (Any of these methods will have some variant of these issues though.) So make sure to implement a check for that...

6 hours ago, Smurfin said:

Simulating x% chance like that using randomized number is correct, right ? it's still gonna be x% that way.

Yes.

Roses are FF0000, violets are 0000FF... All my base are belong to you.

Link to comment
Share on other sites

  • Moderators

Hi,

This thread has been reported as "game-related". While I agree with this description, I also see that the OP clearly states:

Quote

The actual packs I'm going to simulate are from Perfect World MMO game [my bold]

As long as the discussion remains focused on this simulation rather then the game itself I am happy for the thread to continue.

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

@SadBunny : Ok. I'll keep that in mind when I start working on opening the packs function later.

---

I've made the Interface like this :

Packs%20Opening%20Simulator.jpg~original

 

That blank area on the right is going to be used to list the contents of this pack -> http://www.pwdatabase.com/pwi/items/42202

 

I've made the mini database file (War Avatar Pack S,ini) like below. There are 5 strings separated by commas, the first is The name of the set, second is Grade (S/A/B) and should have different color each which is Orange for S, Yellow for A, Purple for B, third is Card Type and there are six types, fourth is the name of the card, and fifth is the chance. There should be a counter too for each and every card. It's basically like this :

avatar%20pack%20S%20itemlist.jpg~origina

Is it possible to make a script that reads the data in the ini file then create and put it onto a table like above ? if not then I have to put everything hardcoded without customization using ini file.

Right clicking the chest icon should run the function to open the pack and will give info what item appears in the chatbox. left clicking will change pack and contents on the right.

 

Nuema Portal (6) 100%,S,Destroyer,Althea,0.04
Nuema Portal (6) 100%,S,Battle,Kestra,0.04
Nuema Portal (6) 100%,S,Longevity,Astrid,0.04
Nuema Portal (6) 100%,S,Durability,Lorelei,0.04
Four Generals of the Human (4) 60%,S,Battle,Gu Hensin,0.04
Four Generals of the Human (4) 60%,S,Destroyer,Lio Gianni,0.04
Four Generals of the Human (4) 60%,S,Soulprime,Tsen the Heavensent,0.04
Four Generals of the Human (4) 60%,S,Lifeprime,Fen the Victorious,0.04
Dream of Three Generations (3) 40%,S,Destroyer,Ancestor Feng Loriel,0.04
Dream of Three Generations (3) 40%,S,Soulprime,Saint Feng Drime,0.04
Dream of Three Generations (3) 40%,S,Longevity,King Feng Triton,0.04
Balance of Three Races (3) 40%,S,Durability,General Jen,0.04
Balance of Three Races (3) 40%,S,Lifeprime,General Chung,0.04
Balance of Three Races (3) 40%,S,Battle,General Po,0.04
World Watcher (2) 20%,S,Durability,Elder of the Streams,0.04
World Watcher (2) 20%,S,Longevity,Elder of Archosaur,0.04
Twin Stars (2) 20%,S,Battle,Radiance,0.04
Twin Stars (2) 20%,S,Destroyer,Dark Radiance,0.04
Four Lords of the Winged Elf (4) 60%,S,Longevity,Yi the Mighty Wing,0.04
Four Lords of the Winged Elf (4) 60%,S,Durability,Feather Lord,0.04
Four Lords of the Winged Elf (4) 60%,S,Soulprime,Ien the Arbor,0.04
Four Lords of the Winged Elf (4) 60%,S,Lifeprime,Yi the Earthquake,0.04
Sin of the Fallen God (2) 20%,S,Soulprime,Minister Tsu,0.04
Sin of the Fallen God (2) 20%,S,Lifeprime,Tsuan,0.04
Autumn Omen (2) 20%,S,Battle,Yeh Kuhan,0.04
Inner Devil (4) 60%,S,Lifeprime,Holeen,0.04
Inner Devil (4) 60%,S,Longevity,Vanished Ancestor,0.04
Non Set,S,Soulprime,Harpy Wraith,0.04
Non Set,S,Battle,Archdemon Isrifar,0.04
Powerful Army (2) 20%,S,Destroyer,General Summer,0.04
Aria of Dawn (3) 40%,S,Longevity,Emperor Tsang,0.04
Symphony of Fate (2) 20%,S,Durability,Princess of Moonlight,0.04
Symphony of Fate (2) 20%,S,Destroyer,Chungyun,0.04
Aria of Dawn (3) 40%,S,Soulprime,Lethal Vengeance,0.04
Aria of Dawn (3) 40%,S,Lifeprime,Armageddon,0.04
Sacred Feather Wings (2) 20%,S,Durability,Elven Priest Yuusa,0.04
Sacred Feather Wings (2) 20%,S,Longevity,Plume City Elder,0.04
NonSet,S,Battle,Etherblade Elder,0.04
Corona (2) 20%,S,Durability,Elder Star,0.04
Corona (2) 20%,S,Lifeprime,Elder Yashimo,0.04
Inner Devil (4) 60%,S,Battle,Yelling to the Sky,0.04
Lord of All Beasts (2) 20%,S,Soulprime,City of the Lost Elder,0.04
Lord of All Beasts (2) 20%,S,Destroyer,Beastmaster Hokka,0.04
Inner Devil (4) 60%,S,Soulprime,Emperor Aurogon,0.04
Wiseman (2) 20%,S,Lifeprime,Tiger Won,0.04
Wiseman (2) 20%,S,Battle,Anonymous Wiseman,0.04
NonSet,S,Durability,Jane the Harper,0.04
Nuema Portal (6) 100%,S,Lifeprime,Grand Wizard Tensa,0.04
Nuema Portal (6) 100%,S,Soulprime,Soul Controller Saki,0.04
Warsong City (6) 70%,S,Longevity,The Incacerate,0.04
NonSet,S,Destroyer,Winged Commander,0.04
NonSet,S,Destroyer,General Helian,0.04
    Celestial Tigers (2) 20%,A,Destroyer,Heavenly Tiger,0.09
Celestial Tigers (2) 20%,A,Battle,Demonic Tiger,0.09
Dark Trio (3) 35%,A,Destroyer,Thom Mundan,0.09
Dark Trio (3) 35%,A,Soulprime,Gaurnob Guard,0.09
Dark Trio (3) 35%,A,Longevity,Monoblat Dracoboa,0.09
Three Venerators (3) 35%,A,Durability,Infernal Spikewing,0.09
Three Venerators (3) 35%,A,Battle,Rancid Venerator,0.09
Three Venerators (3) 35%,A,Lifeprime,Torturess Venerator,0.09
Devil Lord Soul (2) 20%,A,Longevity,Dread Lord Hengchih,0.09
Dimension (4) 50%,A,Durability,Chaotic Ravager,0.09
Dimension (4) 50%,A,Soulprime,Wolfen Ironside,0.09
Dimension (4) 50%,A,Lifeprime,Lady Frostburn,0.09
Dimension (4) 50%,A,Longevity,Ultimate Stance,0.09
Skynet (4) 50%,A,Durability,Primeval Elemental,0.09
Skynet (4) 50%,A,Soulprime,Shonabu,0.09
Skynet (4) 50%,A,Destroyer,Astaria,0.09
Skynet (4) 50%,A,Longevity,Madam Sadi,0.09
Devil Lord Soul (2) 20%,A,Soulprime,Dismal Duke,0.09
NonSet,A,Durability,Dimentora,0.09
NonSet,A,Longevity,Burial Inferno,0.09
Eternal Difference (2) 20%,A,Soulprime,Chin Wuming,0.09
Eternal Difference (2) 20%,A,Lifeprime,Fei Kungxing,0.09
Autumn Omen (2) 20%,A,Durability,Miss Chiu,0.09
Corona (3) 35%,A,Durability,King Kisian,0.09
Shroud (3) 35%,A,Battle,Prophet Mogo,0.09
Luminance (3) 35%,A,Lifeprime,Lord Gugg,0.09
Divine Furies (3) 35%,A,Destroyer,Emissary of Light,0.09
Divine Furies (3) 35%,A,Soulprime,Emissary of Shadow,0.09
Divine Furies (3) 35%,A,Longevity,Emissary of Void,0.09
Oath of Extinction (3) 35%,A,Durability,Emissary of Corona,0.09
Oath of Extinction (3) 35%,A,Battle,Emissary of Shroud,0.09
Oath of Extinction (3) 35%,A,Lifeprime,Emissary of Luminance,0.09
Abaddon (5) 60%,A,Soulprime,Puppeteer,0.09
Abaddon (5) 60%,A,Longevity,Mask of Grief,0.09
Abaddon (5) 60%,A,Durability,Leaf Rain Dryad,0.09
Abaddon (5) 60%,A,Destroyer,Borobudur Lord,0.09
Abaddon (5) 60%,A,Battle,Peachblossom Ritualist,0.09
Seat of Torment (4) 50%,A,Longevity,Queen Xipher,0.09
Seat of Torment (4) 50%,A,Lifeprime,Trap Master Fierce,0.09
Seat of Torment (4) 50%,A,Soulprime,Lord of Captivation,0.09
Seat of Torment (4) 50%,A,Destroyer,Hellfire Abomination,0.09
Powerful Army (2) 20%,A,Battle,Guard Seven,0.09
Six Candleflame Sovereigns (6) 70%,A,Soulprime,Emperor Aohe,0.09
Six Candleflame Sovereigns (6) 70%,A,Longevity,Gorath,0.09
Six Candleflame Sovereigns (6) 70%,A,Durability,Emperor Chigo,0.09
Six Candleflame Sovereigns (6) 70%,A,Battle,Mistress of Night,0.09
Six Candleflame Sovereigns (6) 70%,A,Lifeprime,Ghost Wing,0.09
Six Candleflame Sovereigns (6) 70%,A,Destroyer,Emperor Locen,0.09
NonSet,A,Lifeprime,Duke Blacke,0.09
Autumnal God (3) 35%,A,Longevity,Celestial Sister,0.09
Autumnal God (3) 35%,A,Lifeprime,Tideborn Princess,0.09
Autumnal God (3) 35%,A,Battle,Sheomay,0.09
Warsong City (6) 70%,A,Soulprime,Pestilent Destroyer,0.09
Warsong City (6) 70%,A,Durability,Obscure Reaper,0.09
Warsong City (6) 70%,A,Destroyer,Snakefist Guardian,0.09
Warsong City (6) 70%,A,Lifeprime,Cannonfist Orclord,0.09
Warsong City (6) 70%,A,Battle,Shadowskull Lich,0.09
Human (2) 15%,A,Soulprime,Blademaster Trainer,0.09
Human (2) 15%,A,Battle,Wizard Trainer,0.09
Untamed (2) 15%,A,Longevity,Barbarian Trainer,0.09
Untamed (2) 15%,A,Lifeprime,Venomancer Trainer,0.09
Winged Elf (2) 15%,A,Destroyer,Archer Trainer,0.09
Winged Elf (2) 15%,A,Durability,Cleric Trainer,0.09
T.born (2) 15%,A,Destroyer,Assassin Trainer,0.09
T.born (2) 15%,A,Soulprime,Psychic Trainer,0.09
E.guard (2) 15%,A,Durability,Seeker Trainer,0.09
E.guard (2) 15%,A,Lifeprime,Mystic Trainer,0.09
NonSet,A,Destroyer,Overseer Aeban,0.09
NonSet,A,Destroyer,Pet Skill Trainer Tsu,0.09
NonSet,A,Battle,Lord Isrifar,0.09
Earliest Trial (3) 35%,B,Destroyer,Rend Razorjaw,1.28
Earliest Trial (3) 35%,B,Soulprime,Poisontail Occultist,1.28
Earliest Trial (3) 35%,B,Longevity,Thromh the Mighty,1.28
NonSet,B,Lifeprime,Farng,1.28
NonSet,B,Battle,Krimson Beyond,1.28
NonSet,B,Destroyer,Suzerix, Adalwolf Elder,1.28
Army Crowd (3) 35%,B,Battle,Commander Fugma,1.28
Army Crowd (3) 35%,B,Durability,Archmage Kashu,1.28
Army Crowd (3) 35%,B,Lifeprime,Omnipotent Drake,1.28
NonSet,B,Soulprime,Jewelscalen,1.28
NonSet,B,Longevity,Viriddis Stormhorn,1.28
NonSet,B,Durability,Qingzi,1.28
Twin Lords of Hell (2) 15%,B,Destroyer,Damned Gaurnob,1.28
Twin Lords of Hell (2) 15%,B,Battle,Cenequus Polearm,1.28
NonSet,B,Destroyer,Watchman Chin,1.28
NonSet,B,Battle,Nightspike Bloodguard,1.28
NonSet,B,Soulprime,Soulbanisher,1.28
NonSet,B,Durability,Vipenalt,1.28
NonSet,B,Lifeprime,Fataliqua,1.28
NonSet,B,Longevity,Soulripper,1.28
NonSet,B,Durability,Coredash,1.28
NonSet,B,Soulprime,Djinscream,1.28
NonSet,B,Destroyer,Steelation,1.28
NonSet,B,Longevity,Dark Colluseast,1.28
NonSet,B,Battle,Hu the Head Robber,1.28
NonSet,B,Lifeprime,Inferno of Sacrifice,1.28
NonSet,B,Soulprime,Soul of Hsuehfeng,1.28
NonSet,B,Battle,99 White Guard,1.28
NonSet,B,Destroyer,Chintien,1.28
NonSet,B,Lifeprime,Lord of Percussion,1.28
NonSet,B,Longevity,Cosmoforce,1.28
NonSet,B,Durability,Deathflow,1.28
NonSet,B,Lifeprime,Illusion Nemen,1.28
Dust of History (2) 15%,B,Soulprime,General Wurlord,1.28
Dust of History (2) 15%,B,Lifeprime,General Feng,1.28
NonSet,B,Soulprime,Spirit of Yi Chinglin,1.28
Corona (3) 35%,B,Soulprime,Taomaster Kyno,1.28
Shroud (3) 35%,B,Soulprime,Craftsman Yurin,1.28
Luminance (3) 35%,B,Durability,Tactician Mur,1.28
Corona (3) 35%,B,Longevity,Stargazer Kin Soz,1.28
Shroud (3) 35%,B,Destroyer,Knight Synea,1.28
Luminance (3) 35%,B,Battle,Knight Inuwen,1.28
    NonSet,B,Lifeprime,Mystical Jarax,1.28
NonSet,B,Battle,Relic of Wind,1.28
NonSet,B,Destroyer,Foretoken Bearer,1.28
NonSet,B,Longevity,Burning Soul,1.28
NonSet,B,Durability,Drake Fling,1.28
NonSet,B,Battle,Genesis Blink,1.28
NonSet,B,Destroyer,Massaca Seben,1.28
NonSet,B,Durability,Ancient Tigara,1.28
NonSet,B,Lifeprime,Herzen Sori Demos,1.28
NonSet,B,Longevity,Primal Fear,1.28
NonSet,B,Lifeprime,Buddha's Servant,1.28
NonSet,B,Soulprime,Hauntery Queen,1.28
Lunaweaver (2) 15%,B,Battle,Crimson Lunaweaver,1.28
NonSet,B,Longevity,Herald of Agony,1.28
Lunaweaver (2) 15%,B,Destroyer,Darkness Lunaweaver,1.28
NonSet,B,Durability,Knight of Terror,1.28
NonSet,B,Battle,Bloodsurge Ultera,1.28
NonSet,B,Destroyer,Infernal Sonikbeast,1.28
NonSet,B,Durability,Wang Erhli,1.28
NonSet,B,Longevity,Wang Tali,1.28
Golden Flower Silverleaf (2) 15%,B,Durability,Mrs. Zoologist,1.28
Golden Flower Silverleaf (2) 15%,B,Longevity,Zoologist Yin,1.28
NonSet,B,Lifeprime,Niang Hu,1.28
NonSet,B,Soulprime,Ladywraith,1.28
Wraith Lord (6) 60%,B,Battle,Luminoc Architect,1.28
Wraith Lord (6) 60%,B,Destroyer,Krixxix,1.28
Wraith Lord (6) 60%,B,Longevity,Gouf - Aerox Chief,1.28
Wraith Lord (6) 60%,B,Durability,Demonic Feligar,1.28
Wraith Lord (6) 60%,B,Lifeprime,Khewy - Rattus Lord,1.28
Wraith Lord (6) 60%,B,Soulprime,Oggo,1.28

Packs Opening Simulator.rar

Edited by Smurfin
Link to comment
Share on other sites

That's quite a read, and thanks for posting your code.

The only question I could distill from your last post is this:

6 hours ago, Smurfin said:

Is it possible to make a script that reads the data in the ini file then create and put it onto a table like above ? if not then I have to put everything hardcoded without customization using ini file.

... and the answer is of course yes. There's IniRead (and related functions) but you'd need the actual ini format, but of course you can also simply read the file (FileRead and _FileReadToArray and many others) and do your own parsing. You'd just need one of the fileread commands, some string manipulation commands (StringSplit comes to mind) a loop and a couple of arrays to store your data.

Roses are FF0000, violets are 0000FF... All my base are belong to you.

Link to comment
Share on other sites

Ok, I'll try it later and ask specific question when I bump into a wall.

btw is filereadtoarray a new syntax because i use old autoit version it didn't seem to recognize it the last time i tried it.

 

also, is it possible to create a table with different colors for each data like in my screenshot above ? what syntax would you recommend,

for the chatbox above I ever tried editbox iirc but when I changed color it changed the whole text color in the box, not only the last line.

Edited by Smurfin
Link to comment
Share on other sites

  • Moderators

Smurfin,

Quote

is it possible to create a table with different colors for each data

Look at my GUIListViewEx UDF (the link is in my sig) which allows you to have different colours for each item.

Quote

 I ever tried editbox iirc but when I changed color it changed the whole text color in the box, not only the last line

If you want to vary the colour of the text within the edit, you need a RichEdit control - look in the Help file for details on how to use it.

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

What is this error ?

udferror.jpg~original

It works on the latest AutoIT, but using the latest version makes my older projects not working properly. Is there anyway I could make older autoit working with this udf and recognize that syntax without having to install the latest one ?

 

Link to comment
Share on other sites

You can't make it support an unsupported syntax, you'd have to simply write out the shorthand if:

If $iDims = 2 Then
    $aGLVEx_Data[$iLV_Index][3] = $iStart + 2
Else
    $aGLVEx_Data[$iLV_Index][3] = $iStart
EndIf

In case you didn't know: (X ? Y : Z) is a shorthand way to write: if X then return Y else return Z

Roses are FF0000, violets are 0000FF... All my base are belong to you.

Link to comment
Share on other sites

2 hours ago, SadBunny said:

BUT... Having said that, I would personally choose to troubleshoot the older code and make it work with the latest version.

What's weird is it doesn't show any error when run or compiled, but it's working erratically. It contains packet sending , memory read and write using nomadmemory, and a few other stuffs that I use to multiclient a game and remote all other alt characters to follow me using hotkeys, attack my target, go to xyz position while I'm active on my main character's window. On the latest AutoIT, it's acting up like only working for a few characters but not for the others. I really have no clue and even if I rewrite it, I'll still use the same thing. Don't know what's changed in autoit that makes it acting up like that.

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