Register for your free account! | Forgot your password?

Go Back   elitepvpers > Coders Den > AutoIt
You last visited: Today at 18:05

  • Please register to post and access all features, it's quick, easy and FREE!

Advertisement



Need help with Slider

Discussion on Need help with Slider within the AutoIt forum part of the Coders Den category.

Reply
 
Old   #1
 
mlukac89's Avatar
 
elite*gold: 0
Join Date: Sep 2010
Posts: 473
Received Thanks: 104
Need help with Slider

Hi i have next script

I got inputs where i inputs cast times for skills 2900, 2600, etc... it have 10 skills
but problem is when i start it they cast skill and wait 2,9 sec then go to next skill, so i need to controll speed of casting skills + slider. Something like if cast (slider) on 100% to fire very fast but not to skip key, i dont know how to calculate this.

here is script

mlukac89 is offline  
Old 12/18/2013, 22:19   #2
 
alpines's Avatar
 
elite*gold: 60
Join Date: Aug 2009
Posts: 2,256
Received Thanks: 815
Before you continue developing you should learn the basics about arrays.
It would shorten your code by far.
alpines is offline  
Thanks
1 User
Old 12/18/2013, 22:47   #3
 
mlukac89's Avatar
 
elite*gold: 0
Join Date: Sep 2010
Posts: 473
Received Thanks: 104
But i hate arrays so much especially in Autoit its so confusing ;(
mlukac89 is offline  
Old 12/18/2013, 23:06   #4
 
alpines's Avatar
 
elite*gold: 60
Join Date: Aug 2009
Posts: 2,256
Received Thanks: 815
Handling with arrays makes everything so much easier. Just try to learn how they work after some time you can't solve problems without them.

An example: If you want to set the data of 100 labels you will do it so
Code:
GUICtrlSetData($Label1, "1")
GUICtrlSetData($Label2, "1")
;...
and then you have 100 lines of code but you could solve it like this
Code:
For $i = 0 To UBound($aLabels) - 1
	GUICtrlSetData($aLabels[$i], "1")
Next
3 lines against 100 lines, what do you think is better?
alpines is offline  
Old 12/18/2013, 23:35   #5
 
mlukac89's Avatar
 
elite*gold: 0
Join Date: Sep 2010
Posts: 473
Received Thanks: 104
Oh i see its a only few lines of code and i know is better but i cant find good examples or tutorials to practice with so im now on start

Can you give me maybe a example with my script or some good tutorial ?
mlukac89 is offline  
Old 12/19/2013, 01:14   #6
 
lolkop's Avatar
 
elite*gold: 280
Join Date: May 2007
Posts: 2,818
Received Thanks: 3,483
Quote:
Originally Posted by mlukac89 View Post
Oh i see its a only few lines of code and i know is better but i cant find good examples or tutorials to practice with so im now on start

Can you give me maybe a example with my script or some good tutorial ?
here's an example of array usage with your script...
Code:
Global $DEBUG = True
Global $label[6], $macroArray[2][10][4] ; [line][index][keyInput,checkbox,timeInput,timer]
Global $run, $buttonText[2]=['Start','Stop'], $handle, $keys[10]=[3,4,5,6,7,8,9,0,'ß',"´´"], $labelFont[6]=[400,400,800,400,400,400]

GUICreate("Macro", 602, 290, Default, Default, 0x108E0000)
GUICtrlCreateGroup('', 8, 2, 585, 190)
GUICtrlCreateGroup('', 8, 193, 585, 41)
GUICtrlCreateGroup('', 104, 11, 481, 86)
GUICtrlCreateGroup('', 105, 97, 481, 86)
For $line=0 To 1
	$label[$line] = GUICtrlCreateLabel("Bar No", 120, 32+$line*86, 46, 18)
	GUICtrlCreateCombo("", 121, 54+$line*86, 41, 25)
	GUICtrlSetData(-1, "1|2|3|4")
	For $i=0 To 9
		$macroArray[$line][$i][0] = GUICtrlCreateInput($keys[$i], 208+$i*38, 31+$line*86, 17, 17)
		$macroArray[$line][$i][1] = GUICtrlCreateCheckbox('', 210+$i*38, 51+$line*86, 17, 17)
		$macroArray[$line][$i][2] = GUICtrlCreateInput(1000, 200+$i*38, 72+$line*86, 33, 17)
	Next
Next
$label[2] = GUICtrlCreateLabel("SKILLS", 16, 14, 53, 18)
$label[3] = GUICtrlCreateLabel("Hotkey", 24, 56, 48, 18)
$label[4] = GUICtrlCreateLabel("CTRL + X", 24, 72, 60, 18)
$label[5] = GUICtrlCreateLabel("Cast time", 20, 208, 64, 18)
For $i=0 To 5
	GUICtrlSetFont($label[$i], 9, $labelFont[$i], 0, "Verdana")
Next
$saveBtn = GUICtrlCreateButton("Save", 520, 240, 75, 25)
$startBtn = GUICtrlCreateButton("Start", 8, 240, 75, 25)
$hSlider = GUICtrlCreateSlider(96, 208, 494, 20)

While True
	Switch GUIGetMsg()
		Case -3
			Exit
		Case $startBtn
			$run = Not $run
			GUICtrlSetData($startBtn, $buttonText[$run])
			$handle = WinGetHandle("Archlord")
			If $handle = '' Then
				TrayTip('AL-Macro', 'You need to run Archlord first', 1)
			Else
				TrayTip('AL-Macro', 'Running...', 5000, 1)
			EndIf
	EndSwitch
	If $run Then
		For $i=0 To 9
			If GUICtrlRead($macroArray[0][$i][1])=1 And TimerDiff($macroArray[0][$i][3])>=GUICtrlRead($macroArray[0][$i][2]) Then
				MySend(GUICtrlRead($macroArray[0][$i][0]))
				$macroArray[0][$i][3]=TimerInit()
			EndIf
			If GUICtrlRead($macroArray[1][$i][1])=1 And TimerDiff($macroArray[1][$i][3])>=GUICtrlRead($macroArray[1][$i][2]) Then
				MySend('+'&GUICtrlRead($macroArray[1][$i][0]))
				$macroArray[1][$i][3]=TimerInit()
			EndIf
		Next
	EndIf
WEnd

Func MySend($content)
	If $DEBUG Then Return ConsoleWrite($content&@CRLF)
	Return ControlSend($handle, '', '', $content, 0)
EndFunc
you should allways keep in mind:
less code -> lower chance of making mistakes
lolkop is offline  
Thanks
1 User
Old 12/19/2013, 02:09   #7
 
mlukac89's Avatar
 
elite*gold: 0
Join Date: Sep 2010
Posts: 473
Received Thanks: 104
Thank for this i will now practice a bit with that ;D
mlukac89 is offline  
Old 12/19/2013, 10:39   #8
 
alpines's Avatar
 
elite*gold: 60
Join Date: Aug 2009
Posts: 2,256
Received Thanks: 815
If you use arrays then you can put the control handles inside these indexes which shorten your code by far and makes them more readable.

An quick example
Code:
$aLabels[10] = [GUICtrlCreateLabel(), GUICtrlCreateLabel(), GUICtrlCreateLabel(), GUICtrlCreateLabel(), GUICtrlCreateLabel(), GUICtrlCreateLabel(), GUICtrlCreateLabel(), GUICtrlCreateLabel(), GUICtrlCreateLabel(), GUICtrlCreateLabel()]

For $i = 0 To UBound($aLabels) - 1
	GUICtrlSetData($aLabels[$i], ...)
Next
and the methode you used
Code:
$h1 = GUICtrlCreateLabel()
$h2 = GUICtrlCreateLabel()
$h3 = GUICtrlCreateLabel()
$h4 = GUICtrlCreateLabel()
$h5 = GUICtrlCreateLabel()
$h6 = GUICtrlCreateLabel()
$h7 = GUICtrlCreateLabel()
$h8 = GUICtrlCreateLabel()
$h9 = GUICtrlCreateLabel()
$h10 = GUICtrlCreateLabel()

GUICtrlSetData($h1, ...)
GUICtrlSetData($h2, ...)
GUICtrlSetData($h3, ...)
GUICtrlSetData($h4, ...)
GUICtrlSetData($h5, ...)
GUICtrlSetData($h6, ...)
GUICtrlSetData($h7, ...)
GUICtrlSetData($h8, ...)
GUICtrlSetData($h9, ...)
GUICtrlSetData($h10, ...)
Arrays just contain multiple variable which makes the handling with controls much easier.
alpines is offline  
Old 12/19/2013, 14:29   #9
 
mlukac89's Avatar
 
elite*gold: 0
Join Date: Sep 2010
Posts: 473
Received Thanks: 104
example this piece of code from lolkop

Code:
$label[2] = GUICtrlCreateLabel("SKILLS", 16, 14, 53, 18)
$label[3] = GUICtrlCreateLabel("Hotkey", 24, 56, 48, 18)
$label[4] = GUICtrlCreateLabel("CTRL + X", 24, 72, 60, 18)
$label[5] = GUICtrlCreateLabel("Cast time", 20, 208, 64, 18)
For $i=0 To 5
	GUICtrlSetFont($label[$i], 9, $labelFont[$i], 0, "Verdana")
Next
some things dont need to be in array like this labels because u dont need to use it anywhere
mlukac89 is offline  
Old 12/19/2013, 15:47   #10
 
alpines's Avatar
 
elite*gold: 60
Join Date: Aug 2009
Posts: 2,256
Received Thanks: 815
That's right, but it was just an example how you can do it.
Of course you can store more than useless labels.
alpines is offline  
Old 12/19/2013, 19:23   #11
 
lolkop's Avatar
 
elite*gold: 280
Join Date: May 2007
Posts: 2,818
Received Thanks: 3,483
Quote:
Originally Posted by mlukac89 View Post
example this piece of code from lolkop

Code:
$label[2] = GUICtrlCreateLabel("SKILLS", 16, 14, 53, 18)
$label[3] = GUICtrlCreateLabel("Hotkey", 24, 56, 48, 18)
$label[4] = GUICtrlCreateLabel("CTRL + X", 24, 72, 60, 18)
$label[5] = GUICtrlCreateLabel("Cast time", 20, 208, 64, 18)
For $i=0 To 5
	GUICtrlSetFont($label[$i], 9, $labelFont[$i], 0, "Verdana")
Next
some things dont need to be in array like this labels because u dont need to use it anywhere
if u're using one and the same function on more than one variable (in this case SetFont), it's allways usefull to use arrays...

you can change all fonts in 3lines of code... no matter how many labels exist... even for those 4 lines (in total 6), you'd need 4(6) lines to set the fonts, which makes the array usefull for you

Edit:
once you're tryin to handle unknown numbers of variables, you will have to use arrays anyways.
lolkop is offline  
Old 12/20/2013, 18:17   #12
 
mlukac89's Avatar
 
elite*gold: 0
Join Date: Sep 2010
Posts: 473
Received Thanks: 104
Oh i see but i have problem with script you made i put out timer init and timer diff because its not work good i also tried like this, because in game on skill it say example 6 seconds but more cooldown you have like 80% then its cooldown like 1-2

And for cast time too on skill say 2,1 second and i put 2100 but its skip alot, it send keys like 100 ms and it depends of cast time you have 99%

So i need to control cast with slider cast time of skill 2,1 sec + slider = slider on max fire faster, slider on lower fire slower


Code:
If $run Then
		For $i=0 To 9
			If GUICtrlRead($macroArray[0][$i][1])=1 And GUICtrlRead($macroArray[0][$i][2]) Then
				MySend(GUICtrlRead($macroArray[0][$i][0]))
			EndIf
			If GUICtrlRead($macroArray[1][$i][1])=1 And GUICtrlRead($macroArray[1][$i][2]) Then
				MySend('+'&GUICtrlRead($macroArray[1][$i][0]))
			EndIf
		Next
	EndIf

And on the end it need to be something like this :

cast time on skill 2,1 second - + with slider
+ cooldown time from skill 6 sec - + my cooldown 1-80%

skill picture


stats picture


So fire if checked skill bar 1 = 3,4,5,6,7,8,9,0,ß,´´
Fire if checked skill bar 2 = 3,4,5,6,7,8,9,0,ß,´´

wait for cooldown of skill and fire again
mlukac89 is offline  
Old 12/20/2013, 19:15   #13
 
elite*gold: 0
Join Date: Mar 2009
Posts: 7,260
Received Thanks: 33,147
You're using a stupid "system". Just use the highest available time and keep in mind that you have to add a small buffer. The game needs time to recognize the input. You should use something about "23000" ms.
KDeluxe is offline  
Old 12/20/2013, 20:19   #14
 
mlukac89's Avatar
 
elite*gold: 0
Join Date: Sep 2010
Posts: 473
Received Thanks: 104
Why this system is stupid ? I just need to adjust cast time 99% with skill cast time 6 or 5 or 9 seconds ...

But i think you dont understand what i need. If you have for example 50% cast time you need 10 seconds or more to fire 10 skill, but if you have 99% cast or more you need 3-4 second to fire 10 skills, and second problem is skipping skills, it fire like 4,5,7,9,ß but not
3,4,5,6,7,8,9,0,ß,´´
mlukac89 is offline  
Old 12/20/2013, 23:28   #15
 
elite*gold: 0
Join Date: Mar 2009
Posts: 7,260
Received Thanks: 33,147
You want to create a bot for Archlord. It's one of thousand MMORPGs and I'm pretty sure that the basics are the same. That means that you can learn new skills with various effects at higher levels. All skills are having different parameters (Cast Time, Cooldown Time, Duration, Range). There is no way that you can put all skills together. Your slider is simply useless.
Maybe you can equip some gear which will affect all of your skills. You will need far more than a simple slider in that case. Just calculate the time needed by yourself and set up your settings.
KDeluxe is offline  
Reply


Similar Threads Similar Threads
Slider mit JavaScript bauen
06/16/2013 - Web Development - 2 Replies
Hallo zusammen, ich habe vor, meiner Games-Webseite einen komplett neuen Look zu verpassen. Dabei habe ich an eine etwas dynamischere Webseite gedacht. Ich arbeite momentan daran, einen Slider zu bauen. Im Internet habe ich schon einige Slider gefunden, wie zum Beispiel den hier: jQuery-Slider kostenlos downloaden | Webentwickler Blog Jedoch sind mir die alle zu einfach. :cool: Wie kann ich denn so etwas komplett selbst nachbauen und dann später noch erweitern?
Help with slider
10/08/2012 - AutoIt - 2 Replies
Ehy i need help to write a script with slider and if i move slider i write in memory the byte(read of slider) how i can? $PROCESS2 = _MEMORYOPEN(ProcessExists("process")) $Addres = 0x0000001 $read = GUICtrlRead($Slider1) _MemoryAsmWrite(Number($Addres), "BYTE" & $read,"DWORD",$PROCESS2 ) i trie to do a simple function but dont work...
problem mit slider
09/16/2012 - AutoIt - 1 Replies
versuche derzeit in einem kleinen musikplayer über einen slider zu bestimmten stellen im lied zu springen (geht ja mit soundseek in autoit) allerdings stehe ich vor folgendem problem: Local $hLenght = _SoundLength ($hFile, 2) Local $hPosition = _SoundPos ($hFile, 2) Local $hPosition2 = _SoundPos ($hFile, 1) $soundstate = _soundstatus($hfile) if not @error Then Local $SoundLenght = $hLenght / 1000 Local $SoundPosition = $hPosition / 1000
Per Slider Musikstelle ändern
11/22/2011 - AutoIt - 2 Replies
Hallo liebe Community, ich habe mal wieder ein Problem: Ich habe mir ein kleines GUI gebastelt mit dem ich .mp3 dateien abspielen kann. Nun habe ich einen Slider eingebaut um den aktuellen Soundstatus abzufragen. Nur weis ich jetzt nicht so genau wie ich per Slider zur gewünschten stelle im Song switchen kann. Hier sind ein paar Auszüge: Global $h_sound Global $max_sec $Slider2 = GUICtrlCreateSlider(0, 108, 300, 25) GUICtrlSetData($Slider2,0)
[Homepage] Images Slider
04/12/2011 - Flyff Private Server - 4 Replies
Willkommen auf meinem ersten richtigen Tut. Hier wird genau erklärt wie ihr einen "Slider" in eurer Homepage einbaut. Das ist eine Box wo Bidler gezeigt werden. (Je 10 Sekunden wechseln sie sich.) Das gibt es auch in der Elitepvpers Startseite. Viel spass! 1. Neue Javasript Datei namens "slider.js" erstellen 2. Js Datei öffnen und folgendes reinschreiben $(".image_reel").css({'width' : imageReelWidth});



All times are GMT +2. The time now is 18:05.


Powered by vBulletin®
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
SEO by vBSEO ©2011, Crawlability, Inc.
This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

Support | Contact Us | FAQ | Advertising | Privacy Policy | Terms of Service | Abuse
Copyright ©2024 elitepvpers All Rights Reserved.