[Actiona3]Suppression nombres déjà générés

    Publicités

Users Who Are Viewing This Thread (Total: 0, Members: 0, Guests: 0)

BZHland29

Membre
Jan 15, 2016
44
1
314
Bonjour ou bonsoir,

Voilà je cherche quelqu'un qui pourrais me coder une génération de nombre aléatoire et empêcher ensuite de réutiliser les nombres déjà utilisés.

Je sais pas si je suis clair. En fait j'ai déjà la génération de nombre aléatoire :
var valeur = Algorithms.randomInteger(min, max);
Il me manque juste la suppression de ceux déjà utilisés.

Est ce que quelqu'un pourrait me faire ça ?

Merci d'avance :)
 

Evaelis

La Voix de la Sagesse
V
Ancien staff
Apr 28, 2010
22,949
468
1,699
Valhalla
Cela va s’avérer assez dur en sachant qu'Actionnaz ne possède pas de gestion des tableaux / listes.
Cependant tu peux tenter en coupant une chaine de caractères.

A moins que j'ai rate quelque-chose bien sûr
 

TheHardButcher

Programmeur C/C++
V
Dec 14, 2009
1,461
58
964
France
Je n'ai jamais utilisé Actiona 3, mais je vais essayer.

Voilà ou j'en suis arrivé en 1h d'actiona 3 :
Code:
<?xml version="1.0" encoding="UTF-8"?>
<scriptfile>
    <settings program="actiona" version="3.9.1" scriptVersion="1.1.0" os="Windows"/>
    <actions>
        <action name="ActionStop" version="1.0.0"/>
        <action name="ActionLoop" version="1.0.0"/>
        <action name="ActionCallProcedure" version="1.0.0"/>
        <action name="ActionCode" version="1.0.0"/>
        <action name="ActionEndProcedure" version="1.0.0"/>
        <action name="ActionMessageBox" version="1.0.0"/>
        <action name="ActionVariable" version="1.0.0"/>
        <action name="ActionVariableCondition" version="1.0.0"/>
        <action name="ActionBeginProcedure" version="1.0.0"/>
    </actions>
    <parameters/>
    <resources/>
    <script pauseBefore="0" pauseAfter="0">
        <action name="ActionVariable" comment="min = 1">
            <exception id="32" action="0" line=""/>
            <exception id="2" action="1" line=""/>
            <exception id="1" action="0" line=""/>
            <exception id="0" action="0" line=""/>
            <parameter name="type">
                <subParameter name="value" code="0">integer</subParameter>
            </parameter>
            <parameter name="colorValue">
                <subParameter name="value" code="0"></subParameter>
            </parameter>
            <parameter name="variable">
                <subParameter name="value" code="0">min</subParameter>
            </parameter>
            <parameter name="positionValue">
                <subParameter name="unit" code="0">0</subParameter>
                <subParameter name="value" code="0"></subParameter>
            </parameter>
            <parameter name="value">
                <subParameter name="value" code="0">1</subParameter>
            </parameter>
        </action>
        <action name="ActionVariable" comment="max = 10">
            <exception id="32" action="0" line=""/>
            <exception id="2" action="1" line=""/>
            <exception id="1" action="0" line=""/>
            <exception id="0" action="0" line=""/>
            <parameter name="type">
                <subParameter name="value" code="0">integer</subParameter>
            </parameter>
            <parameter name="colorValue">
                <subParameter name="value" code="0"></subParameter>
            </parameter>
            <parameter name="variable">
                <subParameter name="value" code="0">max</subParameter>
            </parameter>
            <parameter name="positionValue">
                <subParameter name="unit" code="0">0</subParameter>
                <subParameter name="value" code="0"></subParameter>
            </parameter>
            <parameter name="value">
                <subParameter name="value" code="0">10</subParameter>
            </parameter>
        </action>
        <action name="ActionVariable" comment="list:string = min">
            <exception id="2" action="1" line=""/>
            <exception id="32" action="0" line=""/>
            <exception id="1" action="0" line=""/>
            <exception id="0" action="0" line=""/>
            <parameter name="type">
                <subParameter name="value" code="0">string</subParameter>
            </parameter>
            <parameter name="colorValue">
                <subParameter name="value" code="0"></subParameter>
            </parameter>
            <parameter name="variable">
                <subParameter name="value" code="0">list</subParameter>
            </parameter>
            <parameter name="positionValue">
                <subParameter name="unit" code="0">0</subParameter>
                <subParameter name="value" code="0"></subParameter>
            </parameter>
            <parameter name="value">
                <subParameter name="value" code="0">$min</subParameter>
            </parameter>
        </action>
        <action name="ActionVariable" comment="tmp:int = min">
            <exception id="32" action="0" line=""/>
            <exception id="2" action="1" line=""/>
            <exception id="1" action="0" line=""/>
            <exception id="0" action="0" line=""/>
            <parameter name="type">
                <subParameter name="value" code="0">integer</subParameter>
            </parameter>
            <parameter name="colorValue">
                <subParameter name="value" code="0"></subParameter>
            </parameter>
            <parameter name="variable">
                <subParameter name="value" code="0">tmp</subParameter>
            </parameter>
            <parameter name="positionValue">
                <subParameter name="unit" code="0">0</subParameter>
                <subParameter name="value" code="0"></subParameter>
            </parameter>
            <parameter name="value">
                <subParameter name="value" code="0">$min</subParameter>
            </parameter>
        </action>
        <action name="ActionCode" comment="tmp++">
            <exception id="2" action="1" line=""/>
            <exception id="1" action="0" line=""/>
            <exception id="0" action="0" line=""/>
            <parameter name="code">
                <subParameter name="value" code="1">tmp++;</subParameter>
            </parameter>
        </action>
        <action name="ActionVariable" comment="list+=|tmp">
            <exception id="2" action="1" line=""/>
            <exception id="32" action="0" line=""/>
            <exception id="1" action="0" line=""/>
            <exception id="0" action="0" line=""/>
            <parameter name="type">
                <subParameter name="value" code="0">string</subParameter>
            </parameter>
            <parameter name="colorValue">
                <subParameter name="value" code="0"></subParameter>
            </parameter>
            <parameter name="variable">
                <subParameter name="value" code="0">list</subParameter>
            </parameter>
            <parameter name="positionValue">
                <subParameter name="unit" code="0">0</subParameter>
                <subParameter name="value" code="0"></subParameter>
            </parameter>
            <parameter name="value">
                <subParameter name="value" code="0">$list|$tmp</subParameter>
            </parameter>
        </action>
        <action name="ActionLoop" comment="goto 005 max times">
            <exception id="2" action="1" line=""/>
            <exception id="1" action="0" line=""/>
            <exception id="0" action="0" line=""/>
            <parameter name="count">
                <subParameter name="value" code="1">max-2</subParameter>
            </parameter>
            <parameter name="line">
                <subParameter name="value" code="0">005</subParameter>
            </parameter>
        </action>
        <action name="ActionMessageBox">
            <exception id="2" action="1" line=""/>
            <exception id="1" action="0" line=""/>
            <exception id="0" action="0" line=""/>
            <parameter name="customIcon">
                <subParameter name="value" code="0"></subParameter>
            </parameter>
            <parameter name="title">
                <subParameter name="value" code="0">$list</subParameter>
            </parameter>
            <parameter name="windowIcon">
                <subParameter name="value" code="0"></subParameter>
            </parameter>
            <parameter name="icon">
                <subParameter name="value" code="0">none</subParameter>
            </parameter>
            <parameter name="type">
                <subParameter name="value" code="0">ok</subParameter>
            </parameter>
            <parameter name="ifYes">
                <subParameter name="action" code="0">do_nothing</subParameter>
                <subParameter name="line" code="0"></subParameter>
            </parameter>
            <parameter name="message">
                <subParameter name="value" code="0">$list</subParameter>
            </parameter>
            <parameter name="textMode">
                <subParameter name="value" code="0">automatic</subParameter>
            </parameter>
            <parameter name="ifNo">
                <subParameter name="action" code="0">do_nothing</subParameter>
                <subParameter name="line" code="0"></subParameter>
            </parameter>
        </action>
        <action name="ActionVariable" comment="int rand;">
            <exception id="2" action="1" line=""/>
            <exception id="32" action="0" line=""/>
            <exception id="1" action="0" line=""/>
            <exception id="0" action="0" line=""/>
            <parameter name="type">
                <subParameter name="value" code="0">integer</subParameter>
            </parameter>
            <parameter name="colorValue">
                <subParameter name="value" code="0"></subParameter>
            </parameter>
            <parameter name="variable">
                <subParameter name="value" code="0">rand</subParameter>
            </parameter>
            <parameter name="positionValue">
                <subParameter name="unit" code="0">0</subParameter>
                <subParameter name="value" code="0"></subParameter>
            </parameter>
            <parameter name="value">
                <subParameter name="value" code="0">0</subParameter>
            </parameter>
        </action>
        <action name="ActionCode" comment="rand = random(min, max)">
            <exception id="2" action="1" line=""/>
            <exception id="1" action="0" line=""/>
            <exception id="0" action="0" line=""/>
            <parameter name="code">
                <subParameter name="value" code="1">rand = Algorithms.randomInteger(min, max);</subParameter>
            </parameter>
        </action>
        <action name="ActionCallProcedure" comment="call is_rand_in_list">
            <exception id="2" action="1" line=""/>
            <exception id="1" action="0" line=""/>
            <exception id="0" action="0" line=""/>
            <parameter name="name">
                <subParameter name="value" code="0">is_rand_in_list</subParameter>
            </parameter>
        </action>
        <action name="ActionVariableCondition" comment="if rand = -1 then go 010 else call delete_rand_from_list">
            <exception id="2" action="1" line=""/>
            <exception id="1" action="0" line=""/>
            <exception id="0" action="0" line=""/>
            <parameter name="ifEqual">
                <subParameter name="action" code="0">goto</subParameter>
                <subParameter name="line" code="0">010</subParameter>
            </parameter>
            <parameter name="ifDifferent">
                <subParameter name="action" code="0">call_procedure</subParameter>
                <subParameter name="line" code="0">delete_rand_from_list</subParameter>
            </parameter>
            <parameter name="comparison">
                <subParameter name="value" code="0">equal</subParameter>
            </parameter>
            <parameter name="variable">
                <subParameter name="value" code="0">rand</subParameter>
            </parameter>
            <parameter name="value">
                <subParameter name="value" code="0">-1</subParameter>
            </parameter>
        </action>
        <action name="ActionMessageBox" comment="print $list">
            <exception id="2" action="1" line=""/>
            <exception id="1" action="0" line=""/>
            <exception id="0" action="0" line=""/>
            <parameter name="customIcon">
                <subParameter name="value" code="0"></subParameter>
            </parameter>
            <parameter name="windowIcon">
                <subParameter name="value" code="0"></subParameter>
            </parameter>
            <parameter name="title">
                <subParameter name="value" code="0">$list</subParameter>
            </parameter>
            <parameter name="type">
                <subParameter name="value" code="0">ok</subParameter>
            </parameter>
            <parameter name="icon">
                <subParameter name="value" code="0">none</subParameter>
            </parameter>
            <parameter name="ifYes">
                <subParameter name="action" code="0">do_nothing</subParameter>
                <subParameter name="line" code="0"></subParameter>
            </parameter>
            <parameter name="message">
                <subParameter name="value" code="0">$list</subParameter>
            </parameter>
            <parameter name="ifNo">
                <subParameter name="action" code="0">do_nothing</subParameter>
                <subParameter name="line" code="0"></subParameter>
            </parameter>
            <parameter name="textMode">
                <subParameter name="value" code="0">automatic</subParameter>
            </parameter>
        </action>
        <action name="ActionMessageBox" comment="print $rand">
            <exception id="2" action="1" line=""/>
            <exception id="1" action="0" line=""/>
            <exception id="0" action="0" line=""/>
            <parameter name="customIcon">
                <subParameter name="value" code="0"></subParameter>
            </parameter>
            <parameter name="title">
                <subParameter name="value" code="0">$rand</subParameter>
            </parameter>
            <parameter name="windowIcon">
                <subParameter name="value" code="0"></subParameter>
            </parameter>
            <parameter name="icon">
                <subParameter name="value" code="0">none</subParameter>
            </parameter>
            <parameter name="type">
                <subParameter name="value" code="0">ok</subParameter>
            </parameter>
            <parameter name="ifYes">
                <subParameter name="action" code="0">do_nothing</subParameter>
                <subParameter name="line" code="0"></subParameter>
            </parameter>
            <parameter name="message">
                <subParameter name="value" code="0">$rand</subParameter>
            </parameter>
            <parameter name="textMode">
                <subParameter name="value" code="0">automatic</subParameter>
            </parameter>
            <parameter name="ifNo">
                <subParameter name="action" code="0">do_nothing</subParameter>
                <subParameter name="line" code="0"></subParameter>
            </parameter>
        </action>
        <action name="ActionLoop" comment="goto 010 10 times">
            <exception id="2" action="1" line=""/>
            <exception id="1" action="0" line=""/>
            <exception id="0" action="0" line=""/>
            <parameter name="count">
                <subParameter name="value" code="0">5</subParameter>
            </parameter>
            <parameter name="line">
                <subParameter name="value" code="0">010</subParameter>
            </parameter>
        </action>
        <action name="ActionStop">
            <exception id="2" action="1" line=""/>
            <exception id="1" action="0" line=""/>
            <exception id="0" action="0" line=""/>
        </action>
        <action name="ActionBeginProcedure" comment="is_rand_in_list">
            <exception id="2" action="1" line=""/>
            <exception id="1" action="0" line=""/>
            <exception id="0" action="0" line=""/>
            <parameter name="name">
                <subParameter name="value" code="0">is_rand_in_list</subParameter>
            </parameter>
        </action>
        <action name="ActionVariableCondition" comment="if list contient rand then rand=rand else rand=-1">
            <exception id="2" action="1" line=""/>
            <exception id="1" action="0" line=""/>
            <exception id="0" action="0" line=""/>
            <parameter name="ifEqual">
                <subParameter name="action" code="0">run_code</subParameter>
                <subParameter name="line" code="1"></subParameter>
            </parameter>
            <parameter name="ifDifferent">
                <subParameter name="action" code="0">run_code</subParameter>
                <subParameter name="line" code="1">rand = -1;</subParameter>
            </parameter>
            <parameter name="comparison">
                <subParameter name="value" code="0">contains</subParameter>
            </parameter>
            <parameter name="variable">
                <subParameter name="value" code="0">list</subParameter>
            </parameter>
            <parameter name="value">
                <subParameter name="value" code="0">$rand</subParameter>
            </parameter>
        </action>
        <action name="ActionEndProcedure" comment="is_rand_in_list end">
            <exception id="2" action="1" line=""/>
            <exception id="1" action="0" line=""/>
            <exception id="0" action="0" line=""/>
        </action>
        <action name="ActionBeginProcedure" comment="delete_rand_from_list">
            <exception id="2" action="1" line=""/>
            <exception id="1" action="0" line=""/>
            <exception id="0" action="0" line=""/>
            <parameter name="name">
                <subParameter name="value" code="0">delete_rand_from_list</subParameter>
            </parameter>
        </action>
        <action name="ActionCode" comment="delete substring rand from list string">
            <exception id="2" action="1" line=""/>
            <exception id="1" action="0" line=""/>
            <exception id="0" action="0" line=""/>
            <parameter name="code">
                <subParameter name="value" code="1">list.replace(rand,&quot; &quot;);</subParameter>
            </parameter>
        </action>
        <action name="ActionEndProcedure" comment="delete_rand_from_list end">
            <exception id="2" action="1" line=""/>
            <exception id="1" action="0" line=""/>
            <exception id="0" action="0" line=""/>
        </action>
    </script>
</scriptfile>

Il faut encore réussir a faire fonctionner ça : list.replace(rand,""); afin de supprimer ce qui ne doit plus être là. Bref c'est pas la folie, mais actiona c'est pas si facile a appréhender quand on voudrais faire du vrai code ;)
 
Last edited:

BZHland29

Membre
Jan 15, 2016
44
1
314
C'est déjà pas mal merci ;) je vais voir ce que ça donne :)


Bon c'est un peu galère mais le début fonctionne en tout cas ^^ J'arrive pas à avoir de retour sur la suppression des nombres déjà utilisés mais bon c'est pas grave je m'en passerais :)
 
Last edited: