Wie kann ich das machen?
Zufallsfragen erstellen?
-
- [ offen ]
-
GGGG-Unit -
19. Januar 2007 um 20:06 -
Geschlossen -
Erledigt
-
-
- Offizieller Beitrag
Was bitte so eine "Zufallsfrage" sein?
Ohne Input kein Outputpeethebee
-
- Offizieller Beitrag
Hi,
du mußt schon etwas mehr Butter bei die Fische geben. :schild4:
So long,
Mega
-
ja z.B wenn man auf den button next oder so geht komme eine zufallsfrage z.b:
Wie ist die Quadratzahl von 27?
Die Antwort wäre dann 729!
Also so ungefähr habe ich mir das vorgestellt.mfg
GGGG-Unit
-
- Offizieller Beitrag
Random liefert dir Zufallszahlen. Damit solltest du hier weiterkommen, wenn ich dich richtig verstehe.
peethebee
-
aso habe verstanden wenn ich z.B 30 Fragen haben will muss ich bei random die kleinste zahl 1 und die größe 30 eingeben.
Dann für jede Zahl eine Frage machen oder? -
- Offizieller Beitrag
So könntest du es machen, ja.
Du könntest aber auch die Zahl "27" in der Frage von oben variabel machen.
Je nachdem, was du erreichen willst.peethebee
-
Na toll jetzt weiß ich nicht mehr weiter bin voll verwirrt!!
kann villeicht einer ein script machen mit 5 zufallsfragen damit ich wieder weiter weiß? -
- Offizieller Beitrag
Hallo
Ich würde es mit Arrays machen! Also ungefair so:
[autoit]Dim $zufallsfrage[6] ;wieviele fragen +1! also 5fragen +1 = $zufallsfrage[>>>6<<<]
[/autoit][autoit][/autoit][autoit]$zufallsfrage[1] = "Was ist die wurzel aus 9?"
[/autoit][autoit][/autoit][autoit]
$zufallsfrage[2] = "Wieviel sind 10+5?"
$zufallsfrage[3] = 'Wie definiert ihr perfektion und "einfachheit"?'
$zufallsfrage[4] = "Wieviel sind 5x5?"
$zufallsfrage[5] = "Was ist google?"Dim $zufallsantwort[6]
[/autoit][autoit][/autoit][autoit]$zufallsantwort[1] = "3"
[/autoit][autoit][/autoit][autoit]
$zufallsantwort[2] = "15"
$zufallsantwort[3] = "AutoIt"
$zufallsantwort[4] = "25"
$zufallsantwort[5] = "Eine übergroße weltherschende Suchmaschine"$random = Random(1,5,1)
[/autoit][autoit][/autoit][autoit]$ib = InputBox("Deine antowort..",$zufallsfrage[$rand])
[/autoit][autoit][/autoit][autoit]If $ib = $zufallsantwort[$rand] Then
[/autoit]
MsgBox(0,"","Richtig!")
Else
MsgBox(48,"","Falsch..")
EndIfMfg Spider
-
Danke an Gtaspider.
Wenn ich den script ausführe steht da in Line 19 ist ein fehler. -
- Offizieller Beitrag
Hallo!
ups^^ hab ausversehen eine falsche variable für Random genommen.. so sollte es jetzt gehen:
[autoit]Dim $zufallsfrage[6] ;wieviele fragen +1! also 5fragen +1 = $zufallsfrage[>>>6<<<]
[/autoit]
$zufallsfrage[1] = "Was ist die wurzel aus 9?"
$zufallsfrage[2] = "Wieviel sind 10+5?"
$zufallsfrage[3] = 'Wie definiert ihr perfektion und "einfachheit"?'
$zufallsfrage[4] = "Wieviel sind 5x5?"
$zufallsfrage[5] = "Was ist google?"
Dim $zufallsantwort[6]
$zufallsantwort[1] = "3"
$zufallsantwort[2] = "15"
$zufallsantwort[3] = "AutoIt"
$zufallsantwort[4] = "25"
$zufallsantwort[5] = "Eine übergroße weltherschende Suchmaschine"
$random = Random(1,5,1)
$ib = InputBox("Deine antowort..",$zufallsfrage[$random])
If $ib = $zufallsantwort[$random] Then
MsgBox(0,"","Richtig!")
Else
MsgBox(48,"","Falsch.. Die richtige antwort ist:"&@CRLF&$zufallsantwort[$random])
EndIfMfg Spider
-
- Offizieller Beitrag
GGGG-Unit:
hi
Habe mir jetzt ein eigenes GUI gemacht mit viellen Buttons!!!
Ich will das wenn man auf den Button Training geht das hir kommt:
Hab schon selber versucht aber da kamen immer so fehlerDim $zufallsfrage[6] ;wieviele fragen +1! also 5fragen +1 = $zufallsfrage[>>>6<<<]
$zufallsfrage[1] = "Was ist die wurzel aus 9?"
$zufallsfrage[2] = "Wieviel sind 10+5?"
$zufallsfrage[3] = 'Wie definiert ihr perfektion und "einfachheit"?'
$zufallsfrage[4] = "Wieviel sind 5x5?"
$zufallsfrage[5] = "Was ist google?"Dim $zufallsantwort[6]
$zufallsantwort[1] = "3"
$zufallsantwort[2] = "15"
$zufallsantwort[3] = "AutoIt"
$zufallsantwort[4] = "25"
$zufallsantwort[5] = "Eine übergroße weltherschende Suchmaschine"$random = Random(1,5,1)
$ib = InputBox("Deine antowort..",$zufallsfrage[$random])
If $ib = $zufallsantwort[$random] Then
MsgBox(0,"","Richtig!")
Else
MsgBox(48,"","Falsch.. Die richtige antwort ist:"&@CRLF&$zufallsantwort[$random])
EndIf -
- Offizieller Beitrag
Hallo!
Was pee damit sagen will: Poste lieber fragen ins forum als es über pm an nur 1-2 leute zu fragen
@ggg hab dir auch schon eins geschickt. Hier nochmal die version..:
Spoiler anzeigen
[autoit]#include <GUIConstants.au3>
[/autoit] [autoit][/autoit] [autoit]Dim $zufallsfrage[6] ;wieviele fragen +1! also 5fragen +1 = $zufallsfrage[>>>6<<<]
[/autoit] [autoit][/autoit] [autoit]$zufallsfrage[1] = "Was ist die wurzel aus 9?"
[/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]
$zufallsfrage[2] = "Wieviel sind 10+5?"
$zufallsfrage[3] = 'Wie definiert ihr perfektion und einfachheit?'
$zufallsfrage[4] = "Wieviel sind 5x5?"
$zufallsfrage[5] = "Was ist google?"Dim $zufallsantwort[6]
[/autoit] [autoit][/autoit] [autoit]$zufallsantwort[1] = "3"
[/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]
$zufallsantwort[2] = "15"
$zufallsantwort[3] = "AutoIt"
$zufallsantwort[4] = "25"
$zufallsantwort[5] = "Eine übergroße weltherschende Suchmaschine"GUICreate("Zufallsfragen", 230, 83, 193, 116);Hier wird die GUI erstellt
[/autoit] [autoit][/autoit] [autoit]$frage = GUICtrlCreateLabel('Bitte klicken Sie auf den Button "Training" !', 8, 8, 210, 15);Hier das Fragen Label
[/autoit] [autoit][/autoit] [autoit]
$antwort = GUICtrlCreateInput("Antwort", 8, 24, 209, 21);Hier das Antwort Input
GUICtrlSetState(-1, $GUI_DISABLE);Hier wird das antwort input deaktiviert (es wird grau)
$training = GUICtrlCreateButton("Training", 8, 48, 100, 25);Button Training
$weiter = GUICtrlCreateButton("Weiter", 118, 48, 100, 25);button weiterGUISetState();hier wird die GUI gezeigt
[/autoit] [autoit][/autoit] [autoit]While 1
[/autoit]
$nMsg = GUIGetMsg();Hier wird die gui "überprüft"
Switch $nMsg;Hier wird es geswicht! >> Siehe autoit hile für mehr infos
Case $GUI_EVENT_CLOSE;Wenn man auf das X oben rechts drückt soll das programm beendet werden
Exit
Case $training ;also wenn der button $training gedrückt wird
$random = Random(1, 5, 1);Hier wird eine Random zahl gemacht
GUICtrlSetData($frage,"...");Hier kriegt das fragen label "..." zugewiesen!
Sleep(500);dann wartet er 0.5 sekunden (500ms)
GUICtrlSetData($frage,$zufallsfrage[$random]);Dann kriegt das fragenlabel die zufalls frage zugewisen
GUICtrlSetState($antwort,$GUI_ENABLE);und das antwort input wird aktiviert
While 1;wider eine endlosschleife
$nMsg = GUIGetMsg();wider geprüft..
If $nMsg = $GUI_EVENT_CLOSE Then;Wenn man auf das X oben rechts drückt soll das programm beendet werden
Exit
ElseIf $nMsg = $weiter Then;Wenn man auf den Weiter button klickt wird diese schleife beendet
ExitLoop
EndIf
WEnd
If GuictrlRead($antwort) = $zufallsantwort[$random] Then;wenn man also die schleife beendet hat wird nun geguckt ob antwortinput = zufallsantwort ist!
MsgBox(0,"","Richtig!");wenn ja: eine msgbox mit Richtig!
Else
MsgBox(48, "", "Falsch.. Die richtige antwort ist:" & @CRLF & $zufallsantwort[$random]);wenn nein dann eine msgbox mit falsch und die richtige antwort
EndIf
EndSwitch;endswicht.. also das ende von dem oben erstellten Switch
WEndMfg Spider
-
Sowas wollte ich aber nicht!
Ich habe schon ein GUI gemacht was genau so aussieht:
#include <GUIConstants.au3>GUICreate("Dice Roller", 265, 150, -1, -1)
$button1= GUICtrlCreateButton("D2", 5, 25, 50, 30)
$button2= GUICtrlCreateButton("D3", 65, 25, 50, 30)
$button3= GUICtrlCreateButton("D4", 125, 25, 50, 30)
$button4= GUICtrlCreateButton("D6", 5, 65, 50, 30)
$button5= GUICtrlCreateButton("D8", 65, 65, 50, 30)
$button6= GUICtrlCreateButton("D10", 125, 65, 50, 30)
$button7= GUICtrlCreateButton("D12", 5, 105, 50, 30)
$button8= GUICtrlCreateButton("D20", 65, 105, 50, 30)
$button9= GUICtrlCreateButton("D100", 125, 105, 50, 30)
$button10= GUICtrlCreateButton("Training", 185, 105, 65, 30)
$output = GUICtrlCreateLabel("", 185, 45, 70, 50, 0x1000)
$die = GUICtrlCreateLabel("", 185, 25, 70, 20, 0x1000)
GUICtrlSetFont($output, 24, 800, "", "Comic Sans MS")GuiSetState ()
; Run the GUI until the dialog is closed
While 1
$msg = GUIGetMsg()
Select
Case $msg = $button1
$results = Random(1,2, 1)
$results = " " & $results
GUICtrlSetData($output, $results)
GUICtrlSetData($die, "2 Sided Die")
Case $msg = $button2
$results = Random(1,4)
$results = Int($results)
$results = " " & $results
GUICtrlSetData($output, $results)
GUICtrlSetData($die, "3 Sided Die")
Case $msg = $button3
$results = Random(1,4, 1)
$results = " " & $results
GUICtrlSetData($output, $results)
GUICtrlSetData($die, "4 Sided Die")
Case $msg = $button4
$results = Random(1,6, 1)
$results = " " & $results
GUICtrlSetData($output, $results)
GUICtrlSetData($die, "6 Sided Die")
Case $msg = $button5
$results = Random(1,8)
$results = " " & $results
GUICtrlSetData($output, $results)
GUICtrlSetData($die, "8 Sided Die")
Case $msg = $button6
$results = Random(1,10, 1)
If $results < 10 Then $results = " " & $results
If $results > 9 Then $results = " " & $results
GUICtrlSetData($output, $results)
GUICtrlSetData($die, "10 Sided Die")
Case $msg = $button7
$results = Random(1,12, 1)
If $results < 10 Then $results = " " & $results
If $results > 9 Then $results = " " & $results
GUICtrlSetData($output, $results)
GUICtrlSetData($die, "12 Sided Die")
Case $msg = $button8
$results = Random(1,20, 1)
If $results < 10 Then $results = " " & $results
If $results > 9 Then $results = " " & $results
GUICtrlSetData($output, $results)
GUICtrlSetData($die, "20 Sided Die")
Case $msg = $button9
$results = Random(1,1000, 1)
If $results <10 Then $results = " " & $results
If $results > 9 and $results < 100 Then $results = " " & $results
GUICtrlSetData($output, $results)
GUICtrlSetData($die, "100 Sided Die")
EndSelect
If $msg = $GUI_EVENT_CLOSE Then ExitLoop
WendSo und wenn man dann auf den Button Training geht muss dashir kommen
aber in ein anderen fenster:Dim $zufallsfrage[6] ;wieviele fragen +1! also 5fragen +1 = $zufallsfrage[>>>6<<<]
$zufallsfrage[1] = "Was ist die wurzel aus 9?"
$zufallsfrage[2] = "Wieviel sind 10+5?"
$zufallsfrage[3] = 'Wie definiert ihr perfektion und "einfachheit"?'
$zufallsfrage[4] = "Wieviel sind 5x5?"
$zufallsfrage[5] = "Was ist google?"
Dim $zufallsantwort[6]
$zufallsantwort[1] = "3"
$zufallsantwort[2] = "15"
$zufallsantwort[3] = "AutoIt"
$zufallsantwort[4] = "25"
$zufallsantwort[5] = "Eine übergroße weltherschende Suchmaschine"
$random = Random(1,5,1)
$ib = InputBox("Deine antowort..",$zufallsfrage[$random])
If $ib = $zufallsantwort[$random] Then
MsgBox(0,"","Richtig!")
Else
MsgBox(48,"","Falsch.. Die richtige antwort ist:"&@CRLF&$zufallsantwort[$random])
EndIfMehr will ich garnicht!!!!!!!!!
-
hmmmmmmm warum antwortet keiner?