Novità

Aiuto x uno script

bonalele

Junior Member
Buonasera a tutti avrei bisogno di qualche bravo programmatore per un quesito legato a un mio script. Io sono molto scarso a programmare e voorei se possibile un consiglio da Voi.
Come faccio in un listato a dire di eseguire una condizione If oppure un'altra condizione if:

Condizione 1
If Distanza(b,c) = 30 And Decina(b) = Decina(d) Then
e = Fuori90(d + 30)
If Fuori90(c + 30) = b Then
f = Fuori90(c + 60)
Else
f = Fuori90(c + 30)
End If
End If

Condizione 2
If Distanza(b,c) = 30 And Decina(c) = Decina(a) Then
e = Fuori90(a + 30)
If Fuori90(c + 30) = b Then
f = Fuori90(c + 60)
Else
f = Fuori90(c + 30)
End If
End If

Come faccio a far fare al programma entrambe le condizioni, perchè così come scritto non ne fa neanche una
Spero di essermi spiegato, grazie mille x le Vs risposte o suggerimenti

Raffaele
 
Buonasera a tutti avrei bisogno di qualche bravo programmatore per un quesito legato a un mio script. Io sono molto scarso a programmare e voorei se possibile un consiglio da Voi.
Come faccio in un listato a dire di eseguire una condizione If oppure un'altra condizione if:

Condizione 1
If Distanza(b,c) = 30 And Decina(b) = Decina(d) Then
e = Fuori90(d + 30)
If Fuori90(c + 30) = b Then
f = Fuori90(c + 60)
Else
f = Fuori90(c + 30)
End If
End If

Condizione 2
If Distanza(b,c) = 30 And Decina(c) = Decina(a) Then
e = Fuori90(a + 30)
If Fuori90(c + 30) = b Then
f = Fuori90(c + 60)
Else
f = Fuori90(c + 30)
End If
End If

Come faccio a far fare al programma entrambe le condizioni, perchè così come scritto non ne fa neanche una
Spero di essermi spiegato, grazie mille x le Vs risposte o suggerimenti

Raffaele
Ciao a Tutti

Ho confuso lucciole con lanterne
rifaccio tutto
 
Ultima modifica:
Buongiorno Salvo,
scusa ma le condizioni non sono uguali:

Condizione 1
If Distanza(b,c) = 30 And Decina(b) = Decina(d) Then
e = Fuori90(d + 30)

Condizione 2
If Distanza(b,c) = 30 And Decina(c) = Decina(a) Then
e = Fuori90(a + 30)

il resto del calcolo e' uguale...
 
Buongiorno Salvo,
scusa ma le condizioni non sono uguali:

Condizione 1
If Distanza(b,c) = 30 And Decina(b) = Decina(d) Then
e = Fuori90(d + 30)

Condizione 2
If Distanza(b,c) = 30 And Decina(c) = Decina(a) Then
e = Fuori90(a + 30)

il resto del calcolo e' uguale...
Grazie mi sembravano uguali, provvedo a cambiarlo
 
Ancora grazie a Druid che mi ha fatto notare il mio errore :) (diamo la colpa all'età 75 anni)

Allora iniziamo da capo, ho preso un mio script ho tolto i vecchi calcoli e al loro posto ho messo
le 2 condizioni, ho messo dei commenti, per far capire cosa ho fatto.
In uscita ho messo 2 scrivi
i numeri di sopra sono il risultato della prima condizione
quelli di sotto sono il risultato della seconda condizione

Io in questi casi faccio così, se si può migliorare e ben accetto

Codice:
Option Explicit
Sub Main
   Dim FIn,Ini,A,B,C,D,E,F,G,H,Es,Salvo50
   Dim R1,R2,P1,P2,P3,P4,P5,P6,E1,E2,Caso,Casi
   FIn = EstrazioneFin
   Ini = CInt(InputBox("Inserisci l'estrazione che vuoi iniziare",Salvo50,10690))
   Call ScegliRange(Ini,FIn,Ini,FIn)
   For Es = Ini To FIn
      Messaggio Es
      AvanzamentoElab Ini,FIn,Es
      Caso = 0
      For R1 = 1 To 9
         For P1 = 1 To 4
            For P2 = P1 + 1 To 5
               A = Estratto(Es,R1,P1)
               B = Estratto(Es,R1,P2)
               For R2 = R1 + 1 To 10
                  For P3 = 1 To 4
                     For P4 = P3 + 1 To 5
                        C = Estratto(Es,R2,P3)
                        D = Estratto(Es,R2,P4)
                        If A > 0 And C > 0 Then
                           If A <> C And A <> D And B <> C And B <> D Then
                              'A--B
                              '|  |
                              'C--D
                              'Condizione 1 e 2 devono essere eseguite insieme
                              If(Distanza(B,C) = 30 And Decina(B) = Decina(D)) And (Distanza(B,C) = 30 And Decina(C) = Decina(A)) Then
                                 'Condizione 1
                                 E = Fuori90(D + 30)
                                 If Fuori90(C + 30) = B Then
                                    F = Fuori90(C + 60)
                                 Else
                                    F = Fuori90(C + 30)
                                 End If
                                 'Condizione 2
                                 G = Fuori90(A + 30)
                                 If Fuori90(C + 30) = B Then
                                    H = Fuori90(C + 60)
                                 Else
                                    H = Fuori90(C + 30)
                                 End If
                                 ' End If
                                 Caso = Caso + 1
                                 Casi = Casi + 1
                                 Scrivi String(89,"*") & " Casi Totali " & FormattaStringa(Casi,"0000"),1,,,2
                                 Scrivi String(80,"*") & " Estrazione " &(Es) & " caso " & FormattaStringa(Caso,"0000"),1,,,1
                                 Scrivi(" Estrazione n." & Format2(Es) & " del " & DataEstrazione(Es)),1,0
                                 Scrivi "  " & SiglaRuota(R1) & " ",1,0
                                 For P5 = 1 To 5
                                    E1 = Estratto(Es,R1,P5)
                                    If E1 = A Or E1 = B Then
                                       ColoreTesto 2
                                    Else
                                       ColoreTesto 0
                                    End If
                                    Scrivi Format2(E1) & " ",1,0
                                    ColoreTesto 0
                                 Next
                                 Scrivi
                                 Scrivi(" Estrazione n." & Format2(Es) & " del " & DataEstrazione(Es)),1,0
                                 Scrivi "  " & SiglaRuota(R2) & " ",1,0
                                 For P6 = 1 To 5
                                    E2 = Estratto(Es,R2,P6)
                                    If E2 = C Or E2 = D Then
                                       ColoreTesto 2
                                    Else
                                       ColoreTesto 0
                                    End If
                                    Scrivi Format2(E2) & " ",1,0
                                    ColoreTesto 0
                                 Next
                                 Scrivi
                               Scrivi Format2(E) & " " & Format2(F),1
                              Scrivi Format2(G) & " " & Format2(H),1
                              End If
                           End If
                        End If
                     Next
                  Next
               Next
            Next
         Next
      Next
      If ScriptInterrotto Then Exit Sub
   Next
End Sub
 
Ultima modifica:
Un chiarimento, ho supposto che le condizioni ci devono essere tutti e 2
e quindi nel primo IF ho messo And.

Ma se invece vuol dire che ci può essere o la 1a condizione oppure la 2a
quell'And deve essere modificato in Or ed inserire per ogni condizione
la sua condizione.

In data 11-08
Lo script è da riprendere mi sono accorto che alcune righe erano inutili
 
Ultima modifica:
Un chiarimento, ho supposto che le condizioni ci devono essere tutti e 2
e quindi nel primo IF ho messo And.

Ma se invece vuol dire che ci può essere o la 1a condizione oppure la 2a
quell'And deve essere modificato in Or ed inserire per ogni condizione
la sua condizione.

In data 11-08
Lo script è da riprendere mi sono accorto che alcune righe erano inutili
Buongiorno grazie mille per le risposte. Devo capire le modifiche, sono solo alle prime armi.
Metto l'intero script x capire se è modificabile.
Le condizioni posso essere solo una
Grazie
Raffaele
 
Ecco lo script completo:

Sub Main
Dim ruota(10)
Dim ruote(12)
Dim posta(10)
Dim poste(3)
Dim m(10)
Dim n(10)
Dim n1(10)
Dim n2(10)
Dim n3(10)
Dim n4(10)
Dim n5(10)
posta(1) = 1
'posta(2) = 1
poste(2) = 1
poste(3) = 1
co = 0

fin = EstrazioneFin
ini = fin - 20
For es = ini To fin

'If IndiceMensile(es) = 10 Then
For r = 1 To 12
If r = 11 Then r = 12
For p = 1 To 5
a = Estratto(es,r,p)
For pp = p + 1 To 5
b = Estratto(es,r,pp)
For rr = 1 To 12
If rr = 11 Then rr = 12
'For q = 1 To 5
'For qq = q+1 To 5
c = Estratto(es,rr,p)
d = Estratto(es,rr,pp)
'c1= Estratto(es,r,p)
If(c <> a And c <> b And d <> a And d <> b) Then

If Distanza(a,b) = 30 And Decina(a) = Decina(c) Then
e = Fuori90(c + 30)
If Fuori90(a + 30) = b Then
f = Fuori90(a + 60)
Else
f = Fuori90(a + 30)
End If
End If


If Distanza(a,b) = 30 And Decina(a) = Decina(d) Then
e = Fuori90(d + 30)
If Fuori90(a + 30) = b Then
f = Fuori90(a + 60)
Else
f = Fuori90(a + 30)
End If
End If

If Distanza(a,b) = 30 And Decina(b) = Decina(c) Then
e = Fuori90(c + 30)
If Fuori90(a + 30) = b Then
f = Fuori90(a + 60)
Else
f = Fuori90(a + 30)
End If
End If

If Distanza(a,b) = 30 And Decina(b) = Decina(d) Then
e = Fuori90(d + 30)
If Fuori90(a + 30) = b Then
f = Fuori90(a + 60)
Else
f = Fuori90(a + 30)
End If
End If

If Distanza(a,c) = 30 And Decina(a) = Decina(b) Then
e = Fuori90(b + 30)
If Fuori90(a + 30) = c Then
f = Fuori90(a + 60)
Else
f = Fuori90(a + 30)
End If
End If

If Distanza(a,c) = 30 And Decina(a) = Decina(d) Then
e = Fuori90(d + 30)
If Fuori90(a + 30) = c Then
f = Fuori90(a + 60)
Else
f = Fuori90(a + 30)
End If
End If

If Distanza(a,c) = 30 And Decina(c) = Decina(b) Then
e = Fuori90(b + 30)
If Fuori90(a + 30) = c Then
f = Fuori90(a + 60)
Else
f = Fuori90(a + 30)
End If
End If

If Distanza(a,c) = 30 And Decina(b) = Decina(d) Then
e = Fuori90(d + 30)
If Fuori90(a + 30) = c Then
f = Fuori90(a + 60)
Else
f = Fuori90(a + 30)
End If
End If

If Distanza(a,d) = 30 And Decina(a) = Decina(c) Then
e = Fuori90(c + 30)
If Fuori90(a + 30) = d Then
f = Fuori90(a + 60)
Else
f = Fuori90(a + 30)
End If
End If

If Distanza(a,d) = 30 And Decina(a) = Decina(b) Then
e = Fuori90(b + 30)
If Fuori90(a + 30) = d Then
f = Fuori90(a + 60)
Else
f = Fuori90(a + 30)
End If
End If

If Distanza(a,d) = 30 And Decina(d) = Decina(c) Then
e = Fuori90(c + 30)
If Fuori90(a + 30) = d Then
f = Fuori90(a + 60)
Else
f = Fuori90(a + 30)
End If
End If

If Distanza(a,d) = 30 And Decina(d) = Decina(b) Then
e = Fuori90(d + 30)
If Fuori90(a + 30) = d Then
f = Fuori90(a + 60)
Else
f = Fuori90(a + 30)
End If
End If


If Distanza(c,d) = 30 And Decina(c) = Decina(a) Then
e = Fuori90(a + 30)
If Fuori90(c + 30) = d Then
f = Fuori90(c + 60)
Else
f = Fuori90(c + 30)
End If
End If

If Distanza(c,d) = 30 And Decina(c) = Decina(b) Then
e = Fuori90(b + 30)
If Fuori90(c + 30) = d Then
f = Fuori90(c + 60)
Else
f = Fuori90(c + 30)
End If
End If

If Distanza(c,d) = 30 And Decina(d) = Decina(a) Then
e = Fuori90(a + 30)
If Fuori90(c + 30) = d Then
f = Fuori90(c + 60)
Else
f = Fuori90(c + 30)
End If
End If

If Distanza(c,d) = 30 And Decina(d) = Decina(b) Then
e = Fuori90(b + 30)
If Fuori90(c + 30) = d Then
f = Fuori90(c + 60)
Else
f = Fuori90(c + 30)
End If
End If


If Distanza(b,c) = 30 And Decina(b) = Decina(a) Then
e = Fuori90(a + 30)
If Fuori90(c + 30) = b Then
f = Fuori90(c + 60)
Else
f = Fuori90(c + 30)
End If
End If

If Distanza(b,c) = 30 And Decina(b) = Decina(d) Then
e = Fuori90(d + 30)
If Fuori90(c + 30) = b Then
f = Fuori90(c + 60)
Else
f = Fuori90(c + 30)
End If
End If

If Distanza(b,c) = 30 And Decina(c) = Decina(a) Then
e = Fuori90(a + 30)
If Fuori90(c + 30) = b Then
f = Fuori90(c + 60)
Else
f = Fuori90(c + 30)
End If
End If

If Distanza(b,c) = 30 And Decina(c) = Decina(d) Then
e = Fuori90(d + 30)
If Fuori90(c + 30) = b Then
f = Fuori90(c + 60)
Else
f = Fuori90(c + 30)
End If
'End If

co = co + 1
ruota(1) = r
ruota(2) = rr




Scrivi
Scrivi
Scrivi String(65,"*")
Scrivi DataEstrazione(es,1),1
ColoreTesto 1 :
Scrivi "&lt; " & "" & SiglaRuota(r) & " " & StringaEstratti(es,r) & " &gt; 1°numero = " & Format2(a) & " &gt; 2°numero = " & Format2(b) & " massimo a,b " & Massimo(a,b) & " distanza(a,b)" & Distanza(a,b),1
Scrivi "&lt; " & "" & SiglaRuota(rr) & " " & StringaEstratti(es,rr) & " &gt; 3°numero = " & Format2(c) & " &gt; 4°numero = " & Format2(d) & " max + dist x 3 " & Fuori90(Massimo(a,b) +(Distanza(a,b)*3)),1
Scrivi String(65,"-")
Scrivi co


n1(1) = e
n1(2) = f
n1(3) = Fuori90(e - 27)

ImpostaGiocata 18,n1,ruota,posta,9,2

Gioca es,,,1
End If
'Next
End If
'End If






'End If
Next
Next
Next
Next
Next
'Next
'Next
Scrivi
Scrivi String(65,"•")
ColoreTesto 2 : Scrivi "casi trovati : " & co,1
ColoreTesto 0 : Scrivi String(65,"•")
ScriviResoconto
ColoreTesto 1
ColoreTesto 1 : Scrivi "",1




End Sub
 
Ciao Bonalelw

Cioè di quelle 20 condizioni, deve essere vera solo una?

Guarda io sono andato in confusione solo con le 2 condizioni che hai postato
mi ha corretto Druid che ringrazio ancora.

Mi dispiace ma non me sento di prendere questo impegno
 

Ultima estrazione Lotto

  • Estrazione del lotto
    sabato 09 agosto 2025
    Bari
    55
    17
    81
    03
    01
    Cagliari
    75
    84
    06
    34
    27
    Firenze
    30
    74
    59
    61
    62
    Genova
    20
    38
    86
    27
    59
    Milano
    11
    83
    82
    86
    37
    Napoli
    11
    64
    37
    17
    67
    Palermo
    33
    80
    84
    83
    46
    Roma
    51
    68
    37
    90
    42
    Torino
    65
    42
    35
    85
    14
    Venezia
    32
    38
    86
    20
    77
    Nazionale
    71
    85
    05
    10
    61
    Estrazione Simbolotto
    Nazionale
    16
    08
    45
    17
    32

Ultimi Messaggi

Indietro
Alto