/* Module Rotate2, d'après le module Rotate code serveur par iri (http://www.irizone.net), février 2008 sous licence Scol */ var ROT2_FRAMES_PER_SECOND = "30";; /* default framerate value */ var ROT2_INITON = "0";; /* default value */ var ROT2_NOEND = "1";; /* default value */ var ROT2_NUMBER = "1";; /* default value */ var ROT2_ANGX = "100";; /* default value */ var ROT2_ANGY = "100";; /* default value */ var ROT2_ANGZ = "100";; /* default value */ typeof class = S;; typeof ROT2_data = [S r1];; proto setDefaults = fun [S S S S S S S S S S] [S r1];; fun setDefaults(framerate, initon, noend, number, totalangularx, totalangulary, totalangularz, angx, angy, angz)= let ROT2_data -> [a [b [c [d [e [f [g [h [i [j _]]]]]]]]]] in ( if (framerate == nil) || (!strcmp framerate "_") then if a == nil then set framerate = ROT2_FRAMES_PER_SECOND else set framerate = a else nil; if (initon == nil) || (!strcmp initon "_") then if b == nil then set initon = ROT2_INITON else set initon = b else nil; if (noend == nil) || (!strcmp noend "_") then if c == nil then set noend = ROT2_NOEND else set noend = c else nil; if (number == nil) || (!strcmp number "_") then if d == nil then set number = ROT2_NUMBER else set number = d else nil; if (totalangularx == nil) || (!strcmp totalangularx "_") then if e == nil then set totalangularx = "90" else set totalangularx = e else nil; if (totalangulary == nil) || (!strcmp totalangulary "_") then if f == nil then set totalangulary = "90" else set totalangulary = f else nil; if (totalangularz == nil) || (!strcmp totalangularz "_") then if g == nil then set totalangularz = "90" else set totalangularz = g else nil; if (angx == nil) || (!strcmp angx "_") then if h == nil then set angx = ROT2_ANGX else set angx = h else nil; if (angy == nil) || (!strcmp angy "_") then if i == nil then set angy = ROT2_ANGY else set angy = i else nil; if (angz == nil) || (!strcmp angz "_") then if j == nil then set angz = ROT2_ANGZ else set angz = j else nil; framerate :: nil :: angx :: "0" :: angy :: "0" :: angz :: "0" :: number :: "1" :: totalangularx :: totalangulary :: totalangularz :: initon :: noend :: nil );; fun start(o, from, cli, action, param, reply)= UsendMessage ObUi o nil "Start" nil; _DMSevent this nil (strcatn (ObName o) :: ".startedS" :: nil) nil nil;; fun stop(o, from, cli, action, param, reply)= UsendMessage ObUi o nil "Stop" nil; _DMSevent this nil (strcatn (ObName o) :: ".stoppedS" :: nil) nil nil;; fun change(o, from, cli, action, param, reply)= let hd strextr param -> l in let hd l -> angx in let hd tl l -> angy in let hd tl tl l -> angz in let hd tl tl tl l -> framerate in let hd tl tl tl tl l -> initon in let hd tl tl tl tl tl l -> noend in let hd tl tl tl tl tl tl l -> number in let hd tl tl tl tl tl tl tl l -> totalangularX in let hd tl tl tl tl tl tl tl tl l -> totalangularY in let hd tl tl tl tl tl tl tl tl tl l -> totalangularZ in let setDefaults framerate initon noend number totalangularX totalangularY totalangularZ angx angy angz -> l in UsendMessage ObUi o nil "Change" linebuild l; _DMSevent this nil (strcatn (ObName o) :: ".changedS" :: nil) nil nil;; fun newOb(o)= let hd UgetParam ObUi o "angularX" -> angx in let hd UgetParam ObUi o "angularY" -> angy in let hd UgetParam ObUi o "angularZ" -> angz in let hd UgetParam ObUi o "framerate" -> framerate in let hd UgetParam ObUi o "initon" -> initon in let hd UgetParam ObUi o "noend" -> noend in let hd UgetParam ObUi o "number" -> number in let hd UgetParam ObUi o "totalangularX" -> totalangularX in let hd UgetParam ObUi o "totalangularY" -> totalangularY in let hd UgetParam ObUi o "totalangularZ" -> totalangularZ in ( set ROT2_data = setDefaults framerate initon noend number totalangularX totalangularY totalangularZ angx angy angz; ObRegisterAction o (strcatn (ObName o) :: ".startS" :: nil) @start; ObRegisterAction o (strcatn (ObName o) :: ".stopS" :: nil) @stop; ObRegisterAction o (strcatn (ObName o) :: ".changeS" :: nil) @change; 0 );; fun IniPlug(file)= set class = getInfo strextr _getpack _checkpack file "name"; PlugRegister class @newOb nil; 0;;