我已经在Livecode中构建了一个应用,其中卡上有九个按钮。其中的八个按钮播放简短的音乐样本,并具有一个变量,该变量保存按下按钮的次数。按住鼠标按钮,也可以在卡周围拖动按钮。第九个按钮启动一个脚本,该脚本调查与八个样本按钮关联的变量,并确保所有样本至少已被收听一次。该脚本将八个变量放入一个变量,然后检查它们是否为空。如果是,脚本将返回错误消息,提示他们确保已侦听所有示例。我遇到的问题是,除了一个按钮(与变量gVar08关联的一个按钮)之外,其他按钮均可以使用。如果尚未按下此按钮,则gVar08保持为空,并且不会触发错误消息。我不知道为什么。下面提供了与样本按钮和评估按钮相关的脚本。
#Code for music sample button
global gVar08
on mouseDown
wait 30
if the mouseClick then
play audioClip "samples/C1/C1-8ConcertoForViolinStringsAndHarpsichordInGR202IAllegroMolto.wav"
set the filename of image "icn08" to "icons/if_abstract_symbol-03_1571964a.png"
add 1 to gVar08
else
grab me
end if
end mouseDown
#Code assigned to 9th button: Check to see if all samples played at least 1x
global gVar01, gVar02, gVar03, gVar04, gVar05, gVar06, gVar07, gVar08, gErr01
local sClct
on mouseUp
put gVar01, gVar02, gVar03, gVar04, gVar05, gVar06, gVar07, gVar08 into sClct
repeat for each item local in sClct
if local = "" then
answer "Have you listened to all of the samples? Be sure to play them all."
add 1 to gErr01
break
end if
end repeat
end mouseDown
答案 0 :(得分:1)
由于create or replace TRIGGER tupdate_hist_station
AFTER INSERT ON STATION
FOR EACH ROW
DECLARE
V_num_station STATION.NUM_STATION%type;
V_nb_reserve CLIENTS.NB_RESERV%type;
V_revenue number;
BEGIN
SELECT s.NUM_STATION INTO v_num_station
FROM STATION s
WHERE s.NUM_STATION =: NEW.NUM_STATION;
EXCEPTION
WHEN no_data_found THEN
DBMS_OUTPUT.PUT_LINE("There is no new data added");
END;
BEGIN
SELECT sum(c.NB_RESERV) INTO V_nb_reserve
FROM CLIENTS c, RESERVATION r, CHAMBRE ch, HOTEL h, STATION s
WHERE c.NUMC = r.NUMC AND r.IDCHAMBRE = ch.IDCHAMBRE AND ch.NUM_HOTEL = h.NUM_HOTEL
AND h.NUM_STATION = s.NUM_STATION AND s.NUM_STATION = v_num_station;
EXCEPTION
WHEN no_data_found THEN V_nb_reserve:=0;
DBMS_OUTPUT.put_line("There is no reservation in a hotel in this station yet");
END;
BEGIN
SELECT SUM(p.MONTANT) INTO V_revenue
FROM PAYEMENT p, CLIENTS c, RESERVATION r, CHAMBRE ch, HOTEL h, STATION s
where p.NUMC = c.NUMC
AND c.NUMC = r.NUMC
AND r.IDCHAMBRE = ch.IDCHAMBRE
AND ch.NUM_HOTEL = h.NUM_HOTEL
and h.NUM_STATION = s.NUM_STATION AND s.NUM_STATION = v_num_station;
EXCEPTION
WHEN no_data_found THEN
V_revenue := 0;
DBMS_OUTPUT.put_line("There is no reservation in this station yet");
END;
INSERT INTO HIST_STATION("NUM_STATION","ANNEE","NB_RESERV","REVENU") VALUES (V_num_station,(SELECT to_char(SYSDATE,'YYYY')FROM DUAL),V_nb_reserve,V_revenue);
END;
SHOW ERRORS;
是保留字,您是否尝试过使用其他变量?
答案 1 :(得分:0)
我无法使您的“音乐样本”按钮代码正常工作,可能是由于mouseDown处理程序中的mouseClick函数未触发,所以我想出了以下选项:
global gVar08
local sMove
on mouseUp
if sMove then
put empty into sMove
exit to top --Avoids playing the audio and adding 1 to gVar08 on move
end if
play audioClip "samples/C1/C1-8ConcertoForViolinStringsAndHarpsichordInGR202IAllegroMolto.wav"
set the filename of image "icn08" to "icons/if_abstract_symbol-03_1571964a.png"
add 1 to gVar08
end mouseUp
on mouseStillDown
if the mouse is down then
put "true" into sMove
grab me
end if
end mouseStillDown
希望这会有所帮助。
保罗
答案 2 :(得分:0)
列表中的gVar08之后需要逗号和“”。如果为空,则列表以7结尾。即使添加为a,也应始终包含最后一个值。