• Hello, I recently updated my project to a new version. 1.20.8 (was 1.19pr6) in the old version the function below worked. as expected with a delay. after update. action delay no longer occurs.


    (tweennum=1 or 2 or 3) all time = "true")

    <action name="name1" scope="local" args="arg1,arg2">


    asyncloop(tweennum,

    action(this action);


    if(tweennum==1,wait(0);
    ,tweennum==2,wait(0.1);
    ,tweennum==3,wait(0.2);
    );
    );

    </action>

    Tell me what could be the problem?
    *confused* *confused*

    3 Mal editiert, zuletzt von john2801 (21. Oktober 2020 um 13:16)

  • wait is evil, dont use it *squint*
    specially not in an asyncloop.

    what are you trying to do?
    there is nothing happening after the wait call


    I have an arrow.
    I want to turn it left or right.
    but for 1 click on it, take 1 action.
    (turn left or right, in this case 1 degree).

    and before I pinched on hotspot (to the right) and my angle of rotation changed.
    Example:
    current degree 0

    pressed and keep clicking on the hotspot and its angle changes to 360
    and it reaches 360 degrees (turn) over time.

    and here the "WAIT" option allowed. increase this time.

    and there is to remove asyncloop then it will simply go through a click and one action (in this case, an increase of 1 degree)

  • this my action

    in krpano 1.19 pr6 it worked.
    <action name="setpotentstate" scope="local" args="hname, hstate" >
    asyncloop(tweennum,
    set(rvalue,get(hotspot[get(hname)].rotate));
    set(minval,get(hotspot[get(hname)].state[stateleft].minangle));
    set(maxval,get(hotspot[get(hname)].state[stateleft].maxangle));
    set(deltaval,get(hotspot[get(hname)].state[stateleft].delta));
    if(hstate == stateleft,
    sub(rvalue,deltaval);
    ,
    add(rvalue,deltaval);
    );
    clamp(rvalue,get(minval),get(maxval));
    set(vvalue, get(varvalues[params].varvalue[get(hotspot[get(hname)].relvar)].value));
    callwith(hotspot[get(hname)],get(hotspot[get(hname)].state[stateleft].valuescale));
    roundval(vvalue);
    setvarvalue(params,get(hotspot[get(hname)].relvar),get(vvalue));
    if(tweennum==1,wait(0);
    ,tweennum==2,wait(0.1);
    ,tweennum==3,wait(0.2);
    );
    );
    </action >

  • i think you might have multiple errors in your code, are you sure that worked in 1.19pr16?

    varvalues[params].varvalue[get(hotspot[get(hname)].relvar)].value // <-- this looks overly complicated *w00t*

    get(hotspot[get(hname)].state[stateleft].valuescale); // <-- whats this? get() needs 2 arguments

    best you show the old live example working and one with your new code

  • this me hotspot


    <hotspot name="altimeter_rotary"
    url="image/bokovaya_right/emptyrotaty.png"
    distorted="true" alpha="1" capture="false" depth="off" handcursor="true"
    zorder="7" zoom="false" ath="-76.36" atv="20.84"
    width="40" height="prop" rx="0"
    ry="0" rz="0" ox="0" oy="0" rotate="-2" scale="0.15"
    edge="center" enabled="true" visible="true" keep="false"
    onover="showselector(altimeter_rotary);"
    onout="hideselector();"
    onclick="potentiometers_click(altimeter_rotary, 1);"
    relvar="altimeter_rotary_v" //<--relvar
    descr="Радиовысотомер" >
    <selector name="sover" ath="-76.4" atv="20.74" width="50" height="prop" rx="0" ry="0" rz="0" ox="0" oy="0" scale="0.3" rotate="0" edge="center" />
    <state name="stateright" sox="12" soy="0" scale="0.3" minangle="0" maxangle="360" delta="1"
    rotscale="calc(rvalue,(vvalue));" valuescale="calc(vvalue,(rvalue));" />
    <state name="stateleft" sox="-12" soy="0" scale="0.3" minangle="0" maxangle="360" delta="1"
    rotscale="calc(rvalue,(vvalue));" valuescale="calc(vvalue,(rvalue));" />
    </hotspot >

    me onclick action


    <action name="potentiometers_click" scope="local" args="hot,tw" >
    clearselectors();

    set(style[posbtnson].ath,get(hotspot[get(hot)].selector[sover].ath));
    set(style[posbtnson].atv,get(hotspot[get(hot)].selector[sover].atv));
    set(style[posbtnson].rx,get(hotspot[get(hot)].selector[sover].rx));
    set(style[posbtnson].ry,get(hotspot[get(hot)].selector[sover].ry));
    set(style[posbtnson].rz,get(hotspot[get(hot)].selector[sover].rz));

    hotspot[pos_left].loadstyle(posbtnson);
    set(hotspot[pos_left].url,%SWFPATH%/module/interface/selector_ccw.png);
    set(hotspot[pos_left].ox,get(hotspot[get(hot)].state[stateleft].sox));
    set(hotspot[pos_left].oy,get(hotspot[get(hot)].state[stateleft].soy));
    txtadd(funcvar,'set(tweennum,',get(tw),');stopdelayedcall(selectorsoff);setpotentstate(',get(hotspot[get(hot)].name),',stateleft');');
    txtadd(funcvarOT,'if(plugin[WebVR].isenabled,,',get(funcvar),');');
    txtadd(funcvarVR,'if(plugin[WebVR].isenabled,',get(funcvar),');');
    set(hotspot[pos_left].onover,get(funcvarVR));
    set(hotspot[pos_left].ondown,get(funcvarOT));

    hotspot[pos_right].loadstyle(posbtnson);
    set(hotspot[pos_right].url,%SWFPATH%/module/interface/selector_cw.png);
    set(hotspot[pos_right].ox,get(hotspot[get(hot)].state[stateright].sox));
    set(hotspot[pos_right].oy,get(hotspot[get(hot)].state[stateright].soy));

    txtadd(funcvar,'set(tweennum,',get(tw),');stopdelayedcall(selectorsoff);setpotentstate(',get(hotspot[get(hot)].name),',stateright');');
    txtadd(funcvarOT,'if(plugin[WebVR].isenabled,,',get(funcvar),');');
    txtadd(funcvarVR,'if(plugin[WebVR].isenabled,',get(funcvar),');');
    set(hotspot[pos_right].onover,get(funcvarVR));
    set(hotspot[pos_right].ondown,get(funcvarOT));

    setkeycontrolmode(regul);
    unlockselectors();

    </action >

    <action name="setpotentstate" scope="local" args="hname, hstate" >
    asyncloop(tweennum,
    set(rvalue,get(hotspot[get(hname)].rotate));
    set(minval,get(hotspot[get(hname)].state[stateleft].minangle));
    set(maxval,get(hotspot[get(hname)].state[stateleft].maxangle));
    set(deltaval,get(hotspot[get(hname)].state[stateleft].delta));
    if(hstate == stateleft,
    sub(rvalue,deltaval);
    ,
    add(rvalue,deltaval);
    );
    clamp(rvalue,get(minval),get(maxval));
    set(vvalue, get(varvalues[params].varvalue[get(hotspot[get(hname)].relvar)].value));
    callwith(hotspot[get(hname)],get(hotspot[get(hname)].state[stateleft].valuescale));
    roundval(vvalue);
    setvarvalue(params,get(hotspot[get(hname)].relvar),get(vvalue));
    if(tweennum==1,wait(0);
    ,tweennum==2,wait(0.1);
    ,tweennum==3,wait(0.2);
    );
    );
    </action >

    onchange action


    <action name="setvarvalue" scope="local" args="group,vname,vvalue" >
    set(varvalues[get(group)].varvalue[get(vname)].value,get(vvalue));
    if(varvalues[get(group)].varvalue[get(vname)].onchange!='',
    set(acts,get(varvalues[get(group)].varvalue[get(vname)].onchange));
    scope(global,get(acts));
    );

    </action >

    rotate action


    <action name="readpotentstate" scope="local" args="hname" >

    set(vvalue, get(varvalues[params].varvalue[get(hotspot[get(hname)].relvar)].value));
    callwith(hotspot[get(hname)],get(hotspot[get(hname)].state[stateleft].rotscale));
    <!-- trace('ANG = ',get(rvalue));-->
    set(hotspot[get(hname)].rotate, get(rvalue));

    </action >


    me scope

    <varvalues name="params" >


    <varvalue name="altimeter_rotary_v" value="0" delta="1" dtype="int0" defvalue="1" minvalue="0" maxvalue="300"
    onchange="readpotentstate(altimeter_rotary); " /> //-- me action for onchange
    </varvalues>

Jetzt mitmachen!

Sie haben noch kein Benutzerkonto auf unserer Seite? Registrieren Sie sich kostenlos und nehmen Sie an unserer Community teil!