Jump to content

Quadratic Script - buggy graph, PLEASE HELP!


Foy
 Share

Recommended Posts

lol actually if you look in my quadratics2.au3 source file the first line is $ePw = "69 :: 3|\|<r|>7!0n|>@$$\/\/0Ro|K3y :: 69"

It's basically 1337 speak for "EncryptionPassword" lol, I think that's a good bunch of special characters. :)

Actually, to correct you, it reads: EncrptionPasswordKey

;)

(You know it's bad when you can easily read that)

Link to comment
Share on other sites

  • Replies 81
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

Actually, to correct you, it reads: EncrptionPasswordKey

;)

(You know it's bad when you can easily read that)

lol i guess i missed a word, well i wrote it a few days ago and didnt read it as i posted it so w/e lol. :)
Link to comment
Share on other sites

I'm so confused now, that e-mail function worked on a friends computer on the same network!!!

;)

But not mine.... *confused* I keep getting RC error 2, cannot connect to server, on his comp it sent it fine, i got the e-mail. :) key and all. xD

Link to comment
Share on other sites

I fixed up the script a bit, made max scaling to 100. ;)

I hope the user doesn't change the .ini file's thing to 1000 or it'll prolly crash lol

I'll post the new script.

Also, still waiting on scaling help! :)

I can do the table of values okay, I failed on the graph. T.T

Link to comment
Share on other sites

Okay new version is up.

Please I implore all you experienced scripters to lend me your hand, this time in a probably simple (yet beyond me) matter of scaling a graph I made.

The compiled exe installer along with all sources are in the zip on the first post.

I need your help or I'll never be able to do it. xP

My ideas:

This one seems complicated, but find the vertex and calculate whether or which side of it the point is on then add/subtract the $scale from it accordingly.

That might be an extra 10 or so lines and I'll go test it out after I finish some school work. x.x

But I'd much appreciate help, the Y-axis needs scaling too and I'm not sure how to do that. :)

And I can't help but notice this thread has gotten decidedly less attention. Is that because my problem is too hard? or because the 6+ pages make people think all my problems are solved? x.x

Link to comment
Share on other sites

what I tried. omg so many things wrong. x.x

func plot()
    $scale = IniRead(@programfilesdir&"\Quadratics2\Quadraticsinfo.ini", "Settings", "GraphScale", "100")
    GUICreate("Graph", 300, 255)
    GuiCtrlCreateGroup("Values", 220, 8, 74, 210)   
    $leave = GuiCtrlCreateButton("Exit", 214, 225, 55, 25)  
    $oo = GuiCtrlCreateButton("?", 271, 225, 25, 25)    
        
    #Region ### START Graph Region ###
    GuiCtrlCreateGraphic(10, 1, 200, 254, $SS_ETCHEDFRAME)
    GuiCtrlSetState(-1,$GUI_DISABLE)
    GUICtrlSetBkColor(-1,0xFFFFFF)
    GUICtrlSetGraphic(-1,$GUI_GR_COLOR, 0x000000)
    GUICtrlSetGraphic(-1,$GUI_GR_Move, 0, 127)
    GUICtrlSetGraphic(-1,$GUI_GR_LINE, 200, 127)
    GUICtrlSetGraphic(-1,$GUI_GR_Move, 100, 0)
    GUICtrlSetGraphic(-1,$GUI_GR_LINE, 100, 254)
    GuiCtrlSetGraphic(-1,$GUI_GR_move, 98, 7)
    GuiCtrlSetGraphic(-1,$GUI_GR_Line, 102, 7)
    GuiCtrlSetGraphic(-1,$GUI_GR_move, 98, 17)
    GuiCtrlSetGraphic(-1,$GUI_GR_Line, 102, 17)
    GuiCtrlSetGraphic(-1,$GUI_GR_move, 98, 27)
    GuiCtrlSetGraphic(-1,$GUI_GR_Line, 102, 27)
    GuiCtrlSetGraphic(-1,$GUI_GR_move, 98, 37)
    GuiCtrlSetGraphic(-1,$GUI_GR_Line, 102, 37)
    GuiCtrlSetGraphic(-1,$GUI_GR_move, 98, 47)
    GuiCtrlSetGraphic(-1,$GUI_GR_Line, 102, 47)
    GuiCtrlSetGraphic(-1,$GUI_GR_move, 98, 57)
    GuiCtrlSetGraphic(-1,$GUI_GR_Line, 102, 57)
    GuiCtrlSetGraphic(-1,$GUI_GR_move, 98, 67)
    GuiCtrlSetGraphic(-1,$GUI_GR_Line, 102, 67)
    GuiCtrlSetGraphic(-1,$GUI_GR_move, 98, 77)
    GuiCtrlSetGraphic(-1,$GUI_GR_Line, 102, 77)
    GuiCtrlSetGraphic(-1,$GUI_GR_move, 98, 87)
    GuiCtrlSetGraphic(-1,$GUI_GR_Line, 102, 87)
    GuiCtrlSetGraphic(-1,$GUI_GR_move, 98, 97)
    GuiCtrlSetGraphic(-1,$GUI_GR_Line, 102, 97)
    GuiCtrlSetGraphic(-1,$GUI_GR_move, 98, 107)
    GuiCtrlSetGraphic(-1,$GUI_GR_Line, 102, 107)
    GuiCtrlSetGraphic(-1,$GUI_GR_move, 98, 117)
    GuiCtrlSetGraphic(-1,$GUI_GR_Line, 102, 117)
    GuiCtrlSetGraphic(-1,$GUI_GR_move, 98, 127)
    GuiCtrlSetGraphic(-1,$GUI_GR_Line, 102, 127)
    GuiCtrlSetGraphic(-1,$GUI_GR_move, 98, 137)
    GuiCtrlSetGraphic(-1,$GUI_GR_Line, 102, 137)
    GuiCtrlSetGraphic(-1,$GUI_GR_move, 98, 147)
    GuiCtrlSetGraphic(-1,$GUI_GR_Line, 102, 147)
    GuiCtrlSetGraphic(-1,$GUI_GR_move, 98, 157)
    GuiCtrlSetGraphic(-1,$GUI_GR_Line, 102, 157)
    GuiCtrlSetGraphic(-1,$GUI_GR_move, 98, 167)
    GuiCtrlSetGraphic(-1,$GUI_GR_Line, 102, 167)
    GuiCtrlSetGraphic(-1,$GUI_GR_move, 98, 177)
    GuiCtrlSetGraphic(-1,$GUI_GR_Line, 102, 177)
    GuiCtrlSetGraphic(-1,$GUI_GR_move, 98, 187)
    GuiCtrlSetGraphic(-1,$GUI_GR_Line, 102, 187)
    GuiCtrlSetGraphic(-1,$GUI_GR_move, 98, 197)
    GuiCtrlSetGraphic(-1,$GUI_GR_Line, 102, 197)
    GuiCtrlSetGraphic(-1,$GUI_GR_move, 98, 207)
    GuiCtrlSetGraphic(-1,$GUI_GR_Line, 102, 207)
    GuiCtrlSetGraphic(-1,$GUI_GR_move, 98, 217)
    GuiCtrlSetGraphic(-1,$GUI_GR_Line, 102, 217)
    GuiCtrlSetGraphic(-1,$GUI_GR_move, 98, 227)
    GuiCtrlSetGraphic(-1,$GUI_GR_Line, 102, 227)
    GuiCtrlSetGraphic(-1,$GUI_GR_move, 98, 237)
    GuiCtrlSetGraphic(-1,$GUI_GR_Line, 102, 237)
    GuiCtrlSetGraphic(-1,$GUI_GR_move, 98, 247)
    GuiCtrlSetGraphic(-1,$GUI_GR_Line, 102, 247)
    ;--------------------------------
    GuiCtrlSetGraphic(-1,$GUI_GR_move, 10, 125)
    GuiCtrlSetGraphic(-1,$GUI_GR_Line, 10, 129)
    GuiCtrlSetGraphic(-1,$GUI_GR_move, 20, 125)
    GuiCtrlSetGraphic(-1,$GUI_GR_Line, 20, 129)
    GuiCtrlSetGraphic(-1,$GUI_GR_move, 30, 125)
    GuiCtrlSetGraphic(-1,$GUI_GR_Line, 30, 129)
    GuiCtrlSetGraphic(-1,$GUI_GR_move, 40, 125)
    GuiCtrlSetGraphic(-1,$GUI_GR_Line, 40, 129)
    GuiCtrlSetGraphic(-1,$GUI_GR_move, 50, 125)
    GuiCtrlSetGraphic(-1,$GUI_GR_Line, 50, 129)
    GuiCtrlSetGraphic(-1,$GUI_GR_move, 60, 125)
    GuiCtrlSetGraphic(-1,$GUI_GR_Line, 60, 129)
    GuiCtrlSetGraphic(-1,$GUI_GR_move, 70, 125)
    GuiCtrlSetGraphic(-1,$GUI_GR_Line, 70, 129)
    GuiCtrlSetGraphic(-1,$GUI_GR_move, 80, 125)
    GuiCtrlSetGraphic(-1,$GUI_GR_Line, 80, 129)
    GuiCtrlSetGraphic(-1,$GUI_GR_move, 90, 125)
    GuiCtrlSetGraphic(-1,$GUI_GR_Line, 90, 129)
    GuiCtrlSetGraphic(-1,$GUI_GR_move, 100, 125)
    GuiCtrlSetGraphic(-1,$GUI_GR_Line, 100, 129)
    GuiCtrlSetGraphic(-1,$GUI_GR_move, 110, 125)
    GuiCtrlSetGraphic(-1,$GUI_GR_Line, 110, 129)
    GuiCtrlSetGraphic(-1,$GUI_GR_move, 120, 125)
    GuiCtrlSetGraphic(-1,$GUI_GR_Line, 120, 129)
    GuiCtrlSetGraphic(-1,$GUI_GR_move, 130, 125)
    GuiCtrlSetGraphic(-1,$GUI_GR_Line, 130, 129)
    GuiCtrlSetGraphic(-1,$GUI_GR_move, 140, 125)
    GuiCtrlSetGraphic(-1,$GUI_GR_Line, 140, 129)
    GuiCtrlSetGraphic(-1,$GUI_GR_move, 150, 125)
    GuiCtrlSetGraphic(-1,$GUI_GR_Line, 150, 129)
    GuiCtrlSetGraphic(-1,$GUI_GR_move, 160, 125)
    GuiCtrlSetGraphic(-1,$GUI_GR_Line, 160, 129)
    GuiCtrlSetGraphic(-1,$GUI_GR_move, 170, 125)
    GuiCtrlSetGraphic(-1,$GUI_GR_Line, 170, 129)
    GuiCtrlSetGraphic(-1,$GUI_GR_move, 180, 125)
    GuiCtrlSetGraphic(-1,$GUI_GR_Line, 180, 129)
    GuiCtrlSetGraphic(-1,$GUI_GR_move, 190, 125)
    GuiCtrlSetGraphic(-1,$GUI_GR_Line, 190, 129)
    ;--------------------------------------------------------
    #endRegion ### END Graph Region ###
    ;get the values in the input boxes
    $A = GuiCtrlRead($input_A)
    $B = GuiCtrlRead($input_B)
    $C = GuiCtrlRead($input_C)
    dim $vertex[2] = [0, 0]
    $vertex[0] = -($B/(2*$A))
    $_1 = ($A*($vertex[0]^2))
    $_2 = ($B*$vertex[0])
    $_3 = $C
    $vertex[1] = ($_1 + $_2 + $_3)
    ;msgbox(0, "Vertex", "X: "& $vertex[0] &" Y: "& $vertex[1]) ; report vertex for testing/debugging   
    dim $yVal[201]
    $i = -100
    Do  ;--- Work out the points, have x go up by one then solve for Y, make an array for the table of values
        ;--- Then plot the point and make a line to the next predicted point and continue.
        $1 = ($A*($i^2))
        $2 = ($B*$i)
        $3 = $C
        $y = ($1 + $2 + $3)
        $yVal[$i+100] = Round($y, $round)
        $yNxt = ($A*(($i+1)^2))+($B*($i+1))+($C)
        $modifier = ($i)/$scale
        if $i < $vertex[0] then 
            GuiCtrlSetGraphic(-1, $GUI_GR_DOT, ($i+100-$modifier), -$y+127-$modifier)
            GuiCtrlSetGraphic(-1,$GUI_GR_move, ($i+100-$modifier), -$y+127-$modifier)
            GuiCtrlSetGraphic(-1,$GUI_GR_Line, ($i+101-$modifier),  -$yNxt+127-$modifier)
        elseif $i > $vertex[0] then
            GuiCtrlSetGraphic(-1, $GUI_GR_DOT, ($i+100+$modifier), -$y+127+$modifier)
            GuiCtrlSetGraphic(-1,$GUI_GR_move, ($i+100+$modifier), -$y+127+$modifier)
            GuiCtrlSetGraphic(-1,$GUI_GR_Line, ($i+101+$modifier), -$yNxt+127+$modifier)
        Else
            GuiCtrlSetGraphic(-1, $GUI_GR_DOT, ($i+100), -$y+127)
            GuiCtrlSetGraphic(-1,$GUI_GR_move, ($i+100), -$y+127)
            GuiCtrlSetGraphic(-1,$GUI_GR_Line, ($i+101), -$yNxt+127)
        EndIf
        $i += 0.5
    Until $i = 100
    GUISetState();----------------------------------------------------------------- 
    $d = 0
    $XY=GuiCtrlCreateLabel("X     Y", 230, 22, 40, 20)
    GUICtrlSetFont($XY, 9, 600)  
    GuiSetFont(8, 400)
    $dist = 228
    $dist2 = 260
    $dX = 25
    $dY = 20
    $r = 5
    #Region ### START Table of Values ###
    ; ------- the Table of values...
    GuiCtrlCreateLabel(round(-$scale/2, 1), $dist, 40, $dx, $dy)    
    GuiCtrlCreateLabel(round(-$scale/2+$scale/10, 1), $dist, 52, $dx, $dy)  
    GuiCtrlCreateLabel(round(-$scale/3.33333333, 1), $dist, 64, $dx, $dy)   
    GuiCtrlCreateLabel(round(-$scale/5, 1), $dist, 76, $dx, $dy)    
    GuiCtrlCreateLabel(round(-$scale/10, 1), $dist, 88, $dx, $dy)   
    GuiCtrlCreateLabel("  0", $dist, 100, $dx, $dy) 
    GuiCtrlCreateLabel(" "&round($scale/10, 1), $dist, 112, $dx, $dy)   
    GuiCtrlCreateLabel(" "&round($scale/5, 1), $dist, 124, $dx, $dy)    
    GuiCtrlCreateLabel(" "&round($scale/3.33333333, 1), $dist, 136, $dx, $dy)   
    GuiCtrlCreateLabel(" "&round($scale/2-$scale/10, 1), $dist, 148, $dx, $dy)  
    GuiCtrlCreateLabel(" "&round($scale/2, 1), $dist, 160, $dx, $dy)    
    ;------------------------------------------;
    GuiCtrlCreateLabel($yVal[50], $dist2, 40, $dx+$r, $dy)  
    GuiCtrlCreateLabel($yVal[60], $dist2, 52, $dx+$r, $dy)  
    GuiCtrlCreateLabel($yVal[70], $dist2, 64, $dx+$r, $dy)  
    GuiCtrlCreateLabel($yVal[80], $dist2, 76, $dx+$r, $dy)  
    GuiCtrlCreateLabel($yVal[90], $dist2, 88, $dx+$r, $dy)  
    GuiCtrlCreateLabel($yVal[100], $dist2, 100, $dx+$r, $dy)    
    GuiCtrlCreateLabel($yVal[110], $dist2, 112, $dx+$r, $dy)    
    GuiCtrlCreateLabel($yVal[120], $dist2, 124, $dx+$r, $dy)    
    GuiCtrlCreateLabel($yVal[130], $dist2, 136, $dx+$r, $dy)    
    GuiCtrlCreateLabel($yVal[140], $dist2, 148, $dx+$r, $dy)    
    GuiCtrlCreateLabel($yVal[150], $dist2, 160, $dx+$r, $dy)
    #cs
    GuiCtrlCreateLabel($yVal[$scale/2], $dist2, 40, $dx+$r, $dy)    
    GuiCtrlCreateLabel($yVal[$scale/2+$scale/10], $dist2, 52, $dx+$r, $dy)  
    GuiCtrlCreateLabel($yVal[$scale-round($scale/3.333333, 1)], $dist2, 64, $dx+$r, $dy)    
    GuiCtrlCreateLabel($yVal[$scale/2+round($scale/3.333333, 1)], $dist2, 76, $dx+$r, $dy)  
    GuiCtrlCreateLabel($yVal[$scale-$Scale/10], $dist2, 88, $dx+$r, $dy)    
    GuiCtrlCreateLabel($yVal[$scale], $dist2, 100, $dx+$r, $dy) 
    GuiCtrlCreateLabel($yVal[$scale+$scale/10], $dist2, 112, $dx+$r, $dy)   
    GuiCtrlCreateLabel($yVal[$scale+$scale/5], $dist2, 124, $dx+$r, $dy)    
    GuiCtrlCreateLabel($yVal[$scale+round($scale/3.333333, 1)], $dist2, 136, $dx+$r, $dy)   
    GuiCtrlCreateLabel($yVal[$scale+$scale/2-$scale/10], $dist2, 148, $dx+$r, $dy)  
    GuiCtrlCreateLabel($yVal[$scale+$scale/2], $dist2, 160, $dx+$r, $dy)
    #ce
    #endRegion ### END Table of Values ###
    while 1
        $msgGraph = GuiGetMsg()
        Select
        case $msgGraph = $GUI_EVENT_CLOSE
            GUISetState(@SW_hide)
            ExitLoop
        case $msgGraph = $leave
            GUISetState(@SW_hide)
            ExitLoop
        case $msgGraph = $oo
            $dimen = MouseGetPos()
            ;ToolTip("Each Tick on the graph represents "&"10"&" units."&@LF&@LF&"Abover there is a table of values, "&@LF&"each pair of corresponding numbers"&@LF&"are across from each other.", $dimen[0], $dimen[1], "Graph", 1)
            ToolTip("Each Tick on the graph represents "&$scale/10)&" units."&@LF&@LF&"Above there is a table of values, "&@LF&"each pair of corresponding numbers"&@LF&"are across from each other.", $dimen[0], $dimen[1], "Graph", 1)
            Sleep(2000)
            ToolTip("")
        EndSelect
    WEnd
    
EndFunc
Link to comment
Share on other sites

You have GUICtrlSetGraphic about 100 times in a row. Look into making a array to shorten your code. You have come a long way. This shouldn't be hard for you to do. Once done, it should shorten your code a bunch, and make it much easier for you to understand.

Read this, and it should help you

http://www.autoitscript.com/wiki/index.php?title=Arrays

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