on('ready', () => { const die = (sides) => randomInteger(sides); var LivelloPergamena = die(6); var IncantesimiLivello1Chierico = die(8) var IncantesimiLivello2Chierico = die(3) var IncantesimiLivello1Mago = die(12) var IncantesimiLivello2Mago = die(12) var IncantesimiLivello3Mago = die(3) var TipoPergamena = die(4); on('chat:message', (msg) => { if ('api' === msg.type && msg.content.match(/^!Pergamena3/)) { if (TipoPergamena = 1) { var PergamenaChierico = 3 for (PergamenaChierico; PergamenaChierico > 0; PergamenaChierico --) { if (LivelloPergamena >0 && LivelloPergamena <5) { if (IncantesimiLivello1Chierico = 1) { sendChat('Incantesimo clericale', `/w gm Cura ferite leggere`); } else if (IncantesimiLivello1Chierico = 2) { sendChat('Incantesimo clericale', `/w gm Individuazione del magico`); } else if (IncantesimiLivello1Chierico = 3) { sendChat('Incantesimo clericale', `/w gm Individuazione del male`); } else if (IncantesimiLivello1Chierico = 4) { sendChat('Incantesimo clericale', `/w gm Luce Magica`); } else if (IncantesimiLivello1Chierico = 5) { sendChat('Incantesimo clericale', `/w gm Protezione dal male`); } else if (IncantesimiLivello1Chierico =6) { sendChat('Incantesimo clericale', `/w gm Resistenza al freddo`); } else if (IncantesimiLivello1Chierico =7) { sendChat('Incantesimo clericale', `/w gm Purificazione dei cibi e dell’acqua`); } else if (IncantesimiLivello1Chierico =8) { sendChat('Incantesimo clericale', `/w gm Scacciapaura`); } } else if (LivelloPergamena >4) { if (IncantesimiLivello2Chierico = 1) { sendChat('Incantesimo clericale', `/w gm Benedizione`); } else if (IncantesimiLivello2Chierico = 2) { sendChat('Incantesimo clericale', `/w gm Blocca-persona`); } else if (IncantesimiLivello2Chierico = 3) { sendChat('Incantesimo clericale', `/w gm Silenzio nel raggio di 5 metri`); } } } } else if (TipoPergamena >1) { var PergamenaMago = 3 for (PergamenaMago; PergamenaMago > 0; PergamenaMago --) { if (LivelloPergamena >0 && LivelloPergamena <4) { if (IncantesimiLivello1Mago = 1) { sendChat('Incantesimo mago', `/w gm Blocca porta`); } else if (IncantesimiLivello1Mago = 2) { sendChat('Incantesimo mago', `/w gm Dardo incantato`); } else if (IncantesimiLivello1Mago = 3) { sendChat('Incantesimo mago', `/w gm Disco levitante`); } else if (IncantesimiLivello1Mago = 4) { sendChat('Incantesimo mago', `/w gm Lettura dei linguaggi`); } else if (IncantesimiLivello1Mago = 5) { sendChat('Incantesimo mago', `/w gm Lettura del magico`); } else if (IncantesimiLivello1Mago =6) { sendChat('Incantesimo mago', `/w gm Luce magica`); } else if (IncantesimiLivello1Mago =7) { sendChat('Incantesimo mago', `/w gm Incantesimo dello charme`); } else if (IncantesimiLivello1Mago =8) { sendChat('Incantesimo mago', `/w gm Incantesimo del sonno`); } else if (IncantesimiLivello1Mago = 9) { sendChat('Incantesimo mago', `/w gm Individuazione del magico`); } else if (IncantesimiLivello1Mago =10) { sendChat('Incantesimo mago', `/w gm Protezione dal male`); } else if (IncantesimiLivello1Mago =11) { sendChat('Incantesimo mago', `/w gm Scudo magico`); } else if (IncantesimiLivello1Mago =12) { sendChat('Incantesimo mago', `/w gm Ventriloquio`); } } else if (LivelloPergamena >3 && LivelloPergamena <6) { if (IncantesimiLivello2Mago = 1) { sendChat('Incantesimo mago', `/w gm Chiavistello magico`); } else if (IncantesimiLivello2Mago = 2) { sendChat('Incantesimo mago', `/w gm Creazione spettrale`); } else if (IncantesimiLivello2Mago = 3) { sendChat('Incantesimo mago', `/w gm E.S.P.`); } else if (IncantesimiLivello2Mago = 4) { sendChat('Incantesimo mago', `/w gm Levitazione`); } else if (IncantesimiLivello2Mago = 5) { sendChat('Incantesimo mago', `/w gm Luce perenne`); } else if (IncantesimiLivello2Mago =6) { sendChat('Incantesimo mago', `/w gm Individuazione del male`); } else if (IncantesimiLivello2Mago =7) { sendChat('Incantesimo mago', `/w gm Immagini illusorie`); } else if (IncantesimiLivello2Mago =8) { sendChat('Incantesimo mago', `/w gm Individuazione dell’invisibile`); } else if (IncantesimiLivello2Mago = 9) { sendChat('Incantesimo mago', `/w gm Individuazione di un oggetto`); } else if (IncantesimiLivello2Mago =10) { sendChat('Incantesimo mago', `/w gm Invisibilità`); } else if (IncantesimiLivello2Mago =11) { sendChat('Incantesimo mago', `/w gm Ragnatela`); } else if (IncantesimiLivello2Mago =12) { sendChat('Incantesimo mago', `/w gm Scassinare`); } } else if (LivelloPergamena =6) { if (IncantesimiLivello3Mago = 1) { sendChat('Incantesimo mago', `/w gm Dispersione del magico`); } else if (IncantesimiLivello3Mago = 2) { sendChat('Incantesimo mago', `/w gm Palla di fuoco`); } else if (IncantesimiLivello3Mago = 3) { sendChat('Incantesimo mago', `/w gm Volo`); } } } } } }) }) This API return ever ever: (From Incantesimo clericale): Cura ferite leggere (From Incantesimo clericale): Cura ferite leggere (From Incantesimo clericale): Cura ferite leggere But the result that i want is a random generator of 3 spells on scroll that are to be various... where i'm wrong? Thanks for the help.