typeof color = I;; typeof win = ObjWin;; typeof rep1 = ObjCheck;; typeof rep2 = ObjCheck;; typeof rep3 = ObjCheck;; typeof rep4 = ObjCheck;; typeof rep5 = ObjCheck;; typeof msg = ObjText;; typeof annul = ObjButton;; typeof cont = ObjButton;; typeof quest = ObjText;; defcom Csuite = suite I I;; var intro = "Bienvenue !\n\nRépondez sincèrement aux questions qui vont suivre\net calculez ainsi votre\n\nQUOTIENT SCOLIEN !\n\nUne question sans réponse donne 0 point.\n\nPour garder toute sa saveur au résultat,\nne vous aidez pas, répondez sincérement, à froid.\n\nLe résultat obtenu est purement indicatif\net ne possède pas de caractères officiels.";; var rep = 0;; fun repChecked()= if _GETcheck rep1 then 0 else if _GETcheck rep2 then 1 else if _GETcheck rep3 then 2 else if _GETcheck rep4 then 3 else if _GETcheck rep5 then 4 else 5;; fun cbContinue(btn, u)= _DStext msg; set rep = repChecked; _DMSsend this Csuite [1 rep];; fun cbCancel(btn, u)= _DMSsend this Csuite [0 rep];; fun cbCheck(check, u, state)= if check == rep1 then (_SETcheck rep2 0; _SETcheck rep3 0; _SETcheck rep4 0; _SETcheck rep5 0) else if check == rep2 then (_SETcheck rep1 0; _SETcheck rep3 0; _SETcheck rep4 0; _SETcheck rep5 0) else if check == rep3 then (_SETcheck rep2 0; _SETcheck rep1 0; _SETcheck rep4 0; _SETcheck rep5 0) else if check == rep4 then (_SETcheck rep2 0; _SETcheck rep3 0; _SETcheck rep1 0; _SETcheck rep5 0) else if check == rep5 then (_SETcheck rep2 0; _SETcheck rep3 0; _SETcheck rep4 0; _SETcheck rep1 0) else nil;; fun boutons(w, h)= set annul = _CBbutton _CRbutton _channel win 5 h-25 70 20 0 "Annuler" @cbCancel 0; set cont = _CBbutton _CRbutton _channel win 75 h-25 70 20 0 "Continuer" @cbContinue 0; 0;; fun cbDestroy(w, u)= _DSwindow win;; fun _paint(wn, u)= _PAINTwindow win;; fun createInterface(w, h)= set win = _CRwindow _channel DMSwin 10 10 w h WN_MENU "Testez votre Quotient Scolien"; boutons w h; set msg = _CRtext _channel win 5 5 w-10 h-35 0 intro; set quest = _SHOWtext _CRtext _channel win 10 5 w-20 35 0 nil WINDOW_HIDDEN; set rep1 = _SHOWcheck _CRcheck _channel win 10 50 w-20 20 0 nil WINDOW_HIDDEN; set rep2 = _SHOWcheck _CRcheck _channel win 10 90 w-20 20 0 nil WINDOW_HIDDEN; set rep3 = _SHOWcheck _CRcheck _channel win 10 130 w-20 20 0 nil WINDOW_HIDDEN; set rep4 = _SHOWcheck _CRcheck _channel win 10 170 w-20 20 0 nil WINDOW_HIDDEN; set rep5 = _SHOWcheck _CRcheck _channel win 10 210 w-20 20 0 nil WINDOW_HIDDEN; _CBwinDestroy win @cbDestroy 0; _CBcheck rep1 @cbCheck 0; _CBcheck rep2 @cbCheck 0; _CBcheck rep3 @cbCheck 0; _CBcheck rep4 @cbCheck 0; _CBcheck rep5 @cbCheck 0; 0;; fun _beforeclose()= cbDestroy nil nil;; fun IniDMI(param)= set color = atoi param; _DMSregister this @_beforeclose; let [400 280] -> [w h] in createInterface w h; 0;; fun __error(code)= _SHOWtext quest WINDOW_UNHIDDEN; _DSbutton cont; if code == 0 then _SETtext quest "Erreur SRV / fun updateScore -> list NIL" else if code == 1 then _SETtext quest "Erreur SRV / fun loginExist -> quotientScolien déjà fait !" else if code == 2 then _SETtext quest "Erreur SRV / fun replaceClis -> client non trouvé" else if code == 3 then _SETtext quest "Erreur SRV / fun getScoreCli -> login client non trouvé" else _SETtext quest "Erreur SRV / indéterminée"; 0;; fun __newQuestion(q, r1, r2, r3, r4, r5)= _PAINTline win 25 45 275 45 DRAW_SOLID 1 0; _PAINTrectangle win 5 5 390 245 DRAW_SOLID 1 0 DRAW_INVISIBLE nil; _SHOWtext quest WINDOW_UNHIDDEN; _SHOWcheck rep1 WINDOW_UNHIDDEN; _SHOWcheck rep2 WINDOW_UNHIDDEN; _SHOWcheck rep3 WINDOW_UNHIDDEN; _SHOWcheck rep4 WINDOW_UNHIDDEN; _SHOWcheck rep5 WINDOW_UNHIDDEN; _SETcheck rep1 0; _SETcheck rep2 0; _SETcheck rep3 0; _SETcheck rep4 0; _SETcheck rep5 0; _SETtext quest q; _SETcheckName rep1 r1; _SETcheckName rep2 r2; _SETcheckName rep3 r3; _SETcheckName rep4 r4; _SETcheckName rep5 r5; 0;; fun __final(score, resultat)= _SHOWcheck rep1 WINDOW_HIDDEN; _SHOWcheck rep2 WINDOW_HIDDEN; _SHOWcheck rep3 WINDOW_HIDDEN; _SHOWcheck rep4 WINDOW_HIDDEN; _SHOWcheck rep5 WINDOW_HIDDEN; _SETtext quest strcat "Sur un total de 106, vous avez obtenu " itoa score; _CRtext _channel win 10 50 400-20 280-70 0 resultat; _DSbutton cont; 0;;