Mailing List Archive: 49091 messages
  • Home
  • Script library
  • AltME Archive
  • Mailing list
  • Articles Index
  • Site search
 

[REBOL] Re: Newbie question...

From: gjones05:mail:orion at: 5-May-2001 5:36

From: "Libertysurf"
<snip> > My script tries to let the user choose a list of words > and to make these words appear in a random order, > at request. I tested the script whith a single block and it worked. > > But now, why do I get "none" at each request ? Could anybody > give me some help ? <snip> > > random/seed now > menulistes: [] > liste_d: copy/deep [ > "Moi et famille" [main genou pied tête nez cheveux orteil oreille bras > pouce jambe oeil] > "Objets" [chaise fenêtre baignoire fourchette lait table four canapé > porte lit réfrigérateur] > "Objets personnels" [camion bol cuillère chaussures pyjama "brosse à > dents" oreiller balle nounours accordéon] > "Aliments" [jus pain orange pâtes gâteau fraise viande raisin pomme > carotte banane fromage purée] > "Animaux" [poule cochon cheval souris lion hyppopotame serpent oiseau > dauphin phoque baleine] > ] > > liste_d: to-block liste_d > > choix: first liste_d > > forskip liste_d 2 [append menulistes to-string first liste_d] > menulistes: sort menulistes > > lecture: func [bl] [to-string pick bb: to-block pick bl 6 random length? > bb] > > view center-face lay: layout [ > > backdrop effect compose [gradient 1x1 (sky) (water)] > across > t: text red ivory 900x300 center font-size 130 "" > return > r: field wrap ivory 900x250 center font-size 100 font-color blue "" > return > > button 680x100 effect [gradient 200.0.0 0.200.0] font-size 25 "Suivant" > [t/text: lecture liste_d show t] > > text-list 200x100 data menulistes [ t/text: lecture liste_d show t ] > ;choix: face/picked > return > ] > > Ronald Gruss
Hello, Ronald, The simple answer most is that 'forskip causes 'liste_d to point to the tail of the block. This word has to be reset to point to the head. This behavior is also true for 'forall. However, 'foreach does not have this behavior. As a side note, when liste_d is first defined, copy/deep is not required, since the word points to that literal block. Here is a revised listing with comments that point to the areas mentioned above: random/seed now menulistes: [] ;;;; copy/deep not really needed here liste_d: copy/deep [ Moi et famille [main genou pied tête nez cheveux orteil oreille bras pouce jambe oeil] Objets [chaise fenêtre baignoire fourchette lait table four canapé porte lit réfrigérateur] Objets personnels [camion bol cuillère chaussures pyjama "brosse à dents" oreiller balle nounours accordéon] Aliments [jus pain orange pâtes gâteau fraise viande raisin pomme carotte banane fromage purée] Animaux [poule cochon cheval souris lion hyppopotame serpent oiseau dauphin phoque baleine] ] liste_d: to-block liste_d choix: first liste_d forskip liste_d 2 [append menulistes to-string first liste_d] ;;;; forskip causes liste_d to point to tail of block - needs to be reset to head liste_d: head liste_d menulistes: sort menulistes lecture: func [bl] [to-string pick bb: to-block pick bl 6 random length? bb] view center-face lay: layout [ backdrop effect compose [gradient 1x1 (sky) (water)] across t: text red ivory 900x300 center font-size 130 "" return r: field wrap ivory 900x250 center font-size 100 font-color blue "" return button 680x100 effect [gradient 200.0.0 0.200.0] font-size 25 "Suivant" [t/text: lecture liste_d show t] text-list 200x100 data menulistes [t/text: lecture liste_d show t] ;choix: face/picked return ] Hope this helps. --Scott Jones