;Alan's Set Pictures script ;Sets multiple spot pictures so that they move when the spot is animated. ;You must be an owner/operator to use it. ;The pictures will move in selectable patterns (see below) ;Activate by saying "setpictures N" where N is the spot number containing the pictures ;Place the following script in its own spot in the room: ON OUTCHAT { i GLOBAL npics GLOBAL pattern GLOBAL spot GLOBAL x_start GLOBAL x_range GLOBAL y_start GLOBAL y_range GLOBAL { "$1" GREPSUB ATOI spot = [ ;***Set picture movement data*** ;in format: [ spot_number number_of_pictures x_start y_start x_stop y_stop pattern ] ;Start and stop positions are in pixels relative to the center of the door. ;+x is to the right, +y is downward ;Patterns: 1 is straight line with even steps ; 2 is straight line with large steps at start, smaller steps at end ; 3 is spiral line with large steps at start, smaller steps at end ; [ 1 10 -200 -200 0 0 1] [ 2 5 200 200 0 0 2 ] ;***End of data*** ] parray = ;see if the spot is defined 0 npics = { temparray = { temparray 1 GET npics = temparray 2 GET x_start = temparray 3 GET y_start = temparray 4 GET x_stop = temparray 5 GET y_stop = temparray 6 GET pattern = } temparray 0 GET spot == IF } parray FOREACH { EXIT } npics NOT IF ; x_stop x_start - x_range = y_stop y_start - y_range = 0 i = 0 spot SETSPOTSTATE 30 ME SETALARM "" CHATSTR = } CHATSTR "^setpics ([0-9]+)" GREPSTR IF ; ;Reset the spot to picture 0 ; { "$1" GREPSUB ATOI spot = 0 spot SETSPOTSTATE "" CHATSTR = } CHATSTR "^reset ([0-9]+)" GREPSTR IF ; ;Get the current mouse position ; { MOUSEPOS y = x = "@" x ITOA & " " & y ITOA & " x = " & x ITOA & ", y = " & y ITOA & LOCALMSG "" CHATSTR = } CHATSTR "mp" == IF } ON ALARM { i GLOBAL npics GLOBAL pattern GLOBAL spot GLOBAL x_start GLOBAL x_range GLOBAL y_start GLOBAL y_range GLOBAL ;Multiply before divide to reduce error! npics 1 - steps = { { x_start x_range i * steps / + x = y_start y_range i * steps / + y = 1000 xfactor = 1000 yfactor = } pattern 1 == IF ; { x_start i 90 * steps / SINE x_range * 1000 / + x = y_start i 90 * steps / SINE y_range * 1000 / + y = 1000 xfactor = 1000 yfactor = } pattern 2 == IF ; { x_start i 90 * steps / SINE x_range * 1000 / + x = y_start i 90 * steps / SINE y_range * 1000 / + y = 360 steps / i * SINE xfactor = 360 steps / i * COSINE yfactor = } pattern 3 == IF ; x xfactor * 1000 / y yfactor * 1000 / spot SETPICLOC i ++ i spot SETSPOTSTATE 30 ME SETALARM } { 0 spot SETSPOTSTATE } i npics 1 - < IFELSE }