GUIOnEventMode - 2. GUI aufrufen

10/30/2010 23:24 mipez#16
Quote:
Originally Posted by pinguin94 View Post
Alle Modifier in ein Array laden und dann einfach immer den Index aufrufen o.O
Würde trotzdem in nem Gewusel enden... die If/Switch-Abfragen bleiben ja :x
10/30/2010 23:31 lolkop#17
mit einem n elementigem array kann man n abfragen auf eine reduzieren (code technisch)...
10/30/2010 23:40 mipez#18
Quote:
Originally Posted by lolkop View Post
mit einem n elementigem array kann man n abfragen auf eine reduzieren (code technisch)...
Hm also die Einträge der Combobox numerisch n zuweisen?
Gib mal bitte ein Beispiel, kann mir das nicht wirklich vorstellen oô
10/30/2010 23:52 ZaZiZu#19
Quote:
Originally Posted by mipez View Post
Hm also die Einträge der Combobox numerisch n zuweisen?
Gib mal bitte ein Beispiel, kann mir das nicht wirklich vorstellen oô
[Only registered and activated users can see links. Click Here To Register...]

man kann ganz simpel gleiche sachen mit nur 1ner variable machen :D

€dit: hier ma beispiel, müsst glaub ich gehen

€dit: nicht hauen, wenns nicht ganz richtig ist xD ist immerhin kurz nach mitternacht
10/31/2010 00:08 lolkop#20
naja wie gesagt ich würde das ganze über arrays lösen.
dabei kannst du alles in einer zeile speichern, und die abfrage beträgt immer 3 zeilen.

an dem beispiel vom vorposter würde das zb so aussehen:
Code:
Func _calculate($sdex,$slvl,$mod_wep,$mod_job)
	Local $imodx[19] = [0.08,0.16,0.24,0.32,0.4,0.48,0.56,0.64,0.72,0.8,0.88,0.96,1.04,1.12,1.2,1.3,1.38,1.5,1.5]
	If StringIsDigit($slvl) And $slvl >= 1 And StringIsDigit($sdex) And $sdex >= 15 Then
		$step1 = Round(($slvl / 8 + $sdex * 4) * $mod_wep + $mod_job - 3)
		If $step1 < 187 Then
			$imod = $step1 * 0.1
			For $i=0 To 18
				If $imod>$i And $imod<$i+1 Then
					$step3 = Round(Round(50 / (200 - $step1) * 0.5 + $imodx[$i],2) * 50)
					MsgBox(0,"","Your Attackspeed in % is:" & @crlf &$step3)
					ExitLoop
				EndIf
			Next
		Else
			MsgBox(0,"","Failed, over 187")
		EndIf
	Else
		MsgBox(0,"","Failed, wrong Parameters")
	EndIf
EndFunc
10/31/2010 10:20 mipez#21
Quote:
Originally Posted by lolkop View Post
naja wie gesagt ich würde das ganze über arrays lösen.
dabei kannst du alles in einer zeile speichern, und die abfrage beträgt immer 3 zeilen.

an dem beispiel vom vorposter würde das zb so aussehen:
Code:
Func _calculate($sdex,$slvl,$mod_wep,$mod_job)
	Local $imodx[19] = [0.08,0.16,0.24,0.32,0.4,0.48,0.56,0.64,0.72,0.8,0.88,0.96,1.04,1.12,1.2,1.3,1.38,1.5,1.5]
	If StringIsDigit($slvl) And $slvl >= 1 And StringIsDigit($sdex) And $sdex >= 15 Then
		$step1 = Round(($slvl / 8 + $sdex * 4) * $mod_wep + $mod_job - 3)
		If $step1 < 187 Then
			$imod = $step1 * 0.1
			For $i=0 To 18
				If $imod>$i And $imod<$i+1 Then
					$step3 = Round(Round(50 / (200 - $step1) * 0.5 + $imodx[$i],2) * 50)
					MsgBox(0,"","Your Attackspeed in % is:" & @crlf &$step3)
					ExitLoop
				EndIf
			Next
		Else
			MsgBox(0,"","Failed, over 187")
		EndIf
	Else
		MsgBox(0,"","Failed, wrong Parameters")
	EndIf
EndFunc
Heißt also ich müsste bei den ComboBoxen prinzipiell das gleiche machen...

EDIT: Hab was Gutes gefunden: _GUICtrlComboBoxEx_AddString(), damit kann ich dem String einen Parameter zuordnen...
Hier mal der Zwischenstand:
Code:
#include <ButtonConstants.au3>
#include <ComboConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <GUIComboBoxEx.au3>

$Form2 = GUICreate("", 117, 171)
$Dex = GUICtrlCreateInput("Dex", 8, 40, 97, 25)
$Level = GUICtrlCreateInput("Level", 8, 8, 97, 25)
;combobox1 start
$Job = _GUICtrlComboBoxEx_Create($Form2,"",8, 104, 97, 120)
Global $jtz[13] = ["Vagrant","Mercenary","Acrobat","Assist","Magician","Knight","Blade","Jester","Ranger","Ringmaster","Billposter","Psykeeper","Elementor"]
Global $tjob[13] = [75,80,75,70,65,60,90,85,75,70,85,70,70]
_GUICtrlComboBoxEx_BeginUpdate($Job)
For $j = 0 To 12
_GUICtrlComboBoxEx_AddString($Job,$jtz[$j],-1,-1,-1,-1,$tjob[$j])
Next
_GUICtrlComboBoxEx_EndUpdate($Job)
;combobox1 end 
;combobox2 start
$Weapon = _GUICtrlComboBoxEx_Create($Form2,"",8,72,97,120)
Global $jsz[10] = ["Sword (One Handed)","Sword (Two Handed)","Axe (One Handed)","Axe (Two Handed)","Stick","Knuckle","Wand","Staff","Yoyo","Bow"]
Global $twep[10] = [0.085,0.035,0.06,0.030,0.05,0.07,0.025,0.045,0.075,0.07]
_GUICtrlComboBoxEx_BeginUpdate($Weapon)
For $j = 0 To 9
_GUICtrlComboBoxEx_AddString($Weapon,$jsz[$j],-1,-1,-1,-1,$twep[$j])
Next
_GUICtrlComboBoxEx_EndUpdate($Weapon)
;combobox2 end
$Calculate = GUICtrlCreateButton("Calculate", 16, 136, 89, 25)
GUISetState(@SW_SHOW)

While 1
	Switch GUIGetMsg()
		Case $GUI_EVENT_CLOSE
			Exit
		Case $Calculate
			$read1 = GUICtrlRead($Dex)
			$read2 = GUICtrlRead($Level)
			$read3 = _GUICtrlComboBoxEx_GetCurSel($Job)
			$read4 = _GUICtrlComboBoxEx_GetCurSel($Weapon)
			
			$jparam = _GUICtrlComboBoxEx_GetItemParam($Job,$read3)
			$wparam = _GUICtrlComboBoxEx_GetItemParam($Weapon,$read4)
			_calculate($read1,$read2,$wparam,$jparam)
	EndSwitch
WEnd

Func _calculate($sdex,$slvl,$mod_wep,$mod_job)
	Local $imodx[19] = [0.08,0.16,0.24,0.32,0.4,0.48,0.56,0.64,0.72,0.8,0.88,0.96,1.04,1.12,1.2,1.3,1.38,1.5,1.5]
	If StringIsDigit($slvl) And $slvl >= 1 And StringIsDigit($sdex) And $sdex >= 15 Then
		$step1 = Round(($slvl / 8 + $sdex * 4) * $mod_wep + $mod_job - 3)
		If $step1 < 187 Then
			$imod = $step1 * 0.1
			For $i=0 To 18
				If $imod>$i And $imod<$i+1 Then
					$step3 = Round(Round(50 / (200 - $step1) * 0.5 + $imodx[$i],2) * 50)
					MsgBox(0,"","Your Attackspeed in % is:" & @crlf &$step3)
					ExitLoop
				EndIf
			Next
		Else
			MsgBox(0,"","Failed, over 187")
		EndIf
	Else
		MsgBox(0,"","Failed, wrong Parameters")
	EndIf
EndFunc
Problem is, dass es iMo fast nur 42% anzeigt, egal was ich eingebe oô
Iwie scheint _GUICtrlComboBoxEx_AddString($Weapon,$jsz[$j],-1,-1,-1,-1,$twep[$j]) die 0.0... in 0 umzuwandeln oô
10/31/2010 21:39 maxi39#22
ne frage, wieso mit gui onevent ein gui aufrufen? geht das net einfacher das gui das man aufrufen will in eine funktion zu packen und die funktion aufrufen?
11/01/2010 11:50 mipez#23
Quote:
Originally Posted by maxi39 View Post
ne frage, wieso mit gui onevent ein gui aufrufen? geht das net einfacher das gui das man aufrufen will in eine funktion zu packen und die funktion aufrufen?
Kommt aufs Gleiche raus^^

Btw. zu meinem _GUICtrlComboBoxEx_AddString()-Problem, es kann nur ne Integer als Value-Parameter eingegeben werden... *1000 / 1000 halt xD