################################################################################ # Buttons test script by Sinanju Sept 2021 (Lapper V7.080) ################################################################################ CatchEvent OnMSO( $userName, $text ) # Player event $idxOfFirstSpace = indexOf( $text, " "); IF( $idxOfFirstSpace == -1 ) THEN $command = $text; $argv = ""; ELSE $command = subStr( $text,0,$idxOfFirstSpace ); $argv = trim( subStr( $text,$idxOfFirstSpace ) ); ENDIF SWITCH ( $command ) CASE "!buttons": DoButtonTest(); BREAK; ENDSWITCH EndCatchEvent Sub DoButtonTest() # need to type > !buttons < to start # Label v Button openPrivButton ("my_button",5,5,100,5,5,20,16,"^1This button is a label on timer (red text on light)"); openPrivButton ("my_button2",5,10,100,5,5,-1,32,"^7This is a ^1clickable ^7button (white text on dark)",DoSomething); # Test colour section openPrivButton ("test_button1",5,20,100,5,5,-1,0,"TB1 - (0) Uncoloured text centred on transparent button"); openPrivButton ("test_button2",5,25,100,5,5,-1,64,"TB2 - (64) Uncoloured text aligned to left on transparent button"); openPrivButton ("test_button3",5,30,100,5,5,-1,128,"TB3 - (128) Uncoloured text aligned to right on transparent button"); openPrivButton ("test_button4",5,35,100,5,5,-1,16,"TB4 - (16) Uncoloured text centred on light grey button"); openPrivButton ("test_button5",5,40,100,5,5,-1,80,"TB5 - (80 = 16 + 64) Uncoloured text aligned to left on light grey button"); openPrivButton ("test_button6",5,45,100,5,5,-1,144,"TB6 - (144 = 16 + 128) Uncoloured text aligned to right on light grey button"); openPrivButton ("test_button7",5,50,100,5,5,-1,32,"TB7 - (32) Uncoloured text centred on dark grey button"); openPrivButton ("test_button8",5,55,100,5,5,-1,96,"TB8 - (96 = 32 + 64) Uncoloured text aligned to left on dark grey button"); openPrivButton ("test_button9",5,60,100,5,5,-1,160,"TB9 - (160 = 32 + 128) Uncoloured text aligned to right on dark grey button"); openPrivButton ("test_button10",5,70,100,5,5,-1,16,"^0TB10 - (Back 16 text 0) Black text centred on light grey button"); openPrivButton ("test_button11",5,75,100,5,5,-1,16,"^1TB11 - (Back 16 text 1) Red text centred on light grey button"); openPrivButton ("test_button12",5,80,100,5,5,-1,16,"^2TB12 - (Back 16 text 2) Green text centred on light grey button"); openPrivButton ("test_button13",5,85,100,5,5,-1,16,"^3TB13 - (Back 16 text 3) Yellow text centred on light grey button"); openPrivButton ("test_button14",5,90,100,5,5,-1,16,"^4TB14 - (Back 16 text 4) Blue text centred on light grey button"); openPrivButton ("test_button15",5,95,100,5,5,-1,16,"^5TB15 - (Back 16 text 5) Violet text centred on light grey button"); openPrivButton ("test_button16",5,100,100,5,5,-1,16,"^6TB16 - (Back 16 text 6) Cyan text centred on light grey button"); openPrivButton ("test_button17",5,105,100,5,5,-1,16,"^7TB17 - (Back 16 text 7) White text centred on light grey button"); openPrivButton ("test_button18",5,110,100,5,5,-1,16,"^8TB18 - (Back 16 text 8) Uncoloured (light grey) text centred on light grey button"); openPrivButton( "test_button 19",5,115,100,5,5,-1,8,"^1TB 19 - (8) This is red text centred on transparent button - blinks every second"); openPrivButton( "test_button 20",5,120,100,5,5,-1,24,"^1TB 20 - (24 = 8 + 16) This is red text centred on light grey button - blinks every second"); openPrivButton( "test_button 21",5,125,100,5,5,-1,40,"^1TB 21 - (40 = 8 +32) This is red text centred on dark grey button - blinks every second"); openPrivButton ("test_button22",5,130,100,5,5,-1,32,"^8TB22 - ^1Assorted ^2colours ^3of ^4text ^5centred ^6on ^7dark ^8grey ^0button"); openPrivButton( "test_button 23",5,140,20,5,5,-1,16,"^0TB 23 - This is%nl%^1text that%nl%^2is on 3 lines"); openPrivButton( "test_button 24",40,140,10,8,4,10,16,"^1%cpt%"); # Countdown from 10 openPrivButton( "test_button 25",55,140,50,5,5,-1,16,langEngine( "%{Greeting}%" ) ); # See translation section at bottom (translation depends on player settings) # some flags openPrivButton( "test_dutch_flagpart1",145,90,40,90,8,25,64,"^1-%nl%^7-%nl%^4-"); # button for 1st part of flag openPrivButton( "test_dutch_flagpart2",155,90,40,90,8,25,64,"^1-%nl%^7-%nl%^4-"); # button for 2nd part of flag openPrivButton( "test_uae_flagpart1",75,119,40,90,8,25,64,"^2-%nl%^7-%nl%^0-"); openPrivButton( "test_uae_flagpart2",85,119,40,90,8,25,64,"^2-%nl%^7-%nl%^0-"); openPrivButton( "test_uae_flagpart3",79,152,20,42,1,25,64,langEngine( "%{red_flag}%")); openPrivButton( "test_uae_flagpart4",80,152,20,42,1,25,64,langEngine( "%{red_flag}%")); openPrivButton( "test_uae_flagpart5",81,152,20,42,1,25,64,langEngine( "%{red_flag}%")); openPrivButton( "test_belgian_flag1",40+9,129+10,20,30,1,22,0,langEngine( "%{black_flag}%") ); openPrivButton( "test_belgian_flag2",40+10,129+10,20,30,1,22,0,langEngine( "%{black_flag}%") ); openPrivButton( "test_belgian_flag3",40+11,129+10,20,30,1,22,0,langEngine( "%{black_flag}%") ); openPrivButton( "test_belgian_flag4",40+12,129+10,20,30,1,22,0,langEngine( "%{black_flag}%") ); openPrivButton( "test_belgian_flag5",40+13,129+10,20,30,1,22,0,langEngine( "%{black_flag}%") ); openPrivButton( "test_belgian_flag6",40+14,129+10,20,30,1,22,0,langEngine( "%{yellow_flag}%") ); openPrivButton( "test_belgian_flag7",40+15,129+10,20,30,1,22,0,langEngine( "%{yellow_flag}%") ); openPrivButton( "test_belgian_flag8",40+16,129+10,20,30,1,22,0,langEngine( "%{yellow_flag}%") ); openPrivButton( "test_belgian_flag9",40+17,129+10,20,30,1,22,0,langEngine( "%{yellow_flag}%") ); openPrivButton( "test_belgian_flag10",40+18,129+10,20,30,1,22,0,langEngine( "%{yellow_flag}%") ); openPrivButton( "test_belgian_flag11",40+19,129+10,20,30,1,22,0,langEngine( "%{red_flag}%") ); openPrivButton( "test_belgian_flag12",40+20,129+10,20,30,1,22,0,langEngine( "%{red_flag}%") ); openPrivButton( "test_belgian_flag13",40+21,129+10,20,30,1,22,0,langEngine( "%{red_flag}%") ); openPrivButton( "test_belgian_flag14",40+22,129+10,20,30,1,22,0,langEngine( "%{red_flag}%") ); # Buttons used in a circular drift scoreboard openPrivButton( "circular_back",100,100,126,126,1,30,64,"^1•"); # red cd (circular drift) background openPrivButton( "circular_backa",100,100,126,126,1,30,64,"^1•"); # red background openPrivButton( "circular_backb",102,104,118,118,1,30,64,"^7•"); # white foreground openPrivButton( "circular_message",122,155,19,5,6,30,0,"YODA says%nl%^0self destruct%nl%^1this button%nl%^0will shortly"); # Set various vars for size and location of buttons $HFR = 110; # HFR - How Far Right from Left edge of main content window (out of 200) $HFD = 15; # HFD - How Far Down from Top edge of main content window (out of 200) $BRW = 38; # BRW - Button Row Width (out of 200 max) $BRHS = 5; # BRHS - Button Row Height - short $BRHL = 44; # BRH - Button Row Height - long $TBS = 5; # TBS - This button spacing $TBT = -1; # TBT - This button Time (in seconds - where -1 means don't close) openPrivButton ("2ndtest_buttonback",$HFR-1,$HFD-2,$BRW+2,$BRHL,$TBS,$TBT,16,""); openPrivButton ("2ndtest_buttons0",$HFR,$HFD,$BRW,$BRHS,$TBS,$TBT,0,"0 - combined text and button colour"); openPrivButton ("2ndtest_buttons1",$HFR,$HFD+5,$BRW,$BRHS,$TBS,$TBT,1,"1 - combined text and button colour"); openPrivButton ("2ndtest_buttons2",$HFR,$HFD+10,$BRW,$BRHS,$TBS,$TBT,2,"2 - combined text and button colour"); openPrivButton ("2ndtest_buttons3",$HFR,$HFD+15,$BRW,$BRHS,$TBS,$TBT,3,"3 - combined text and button colour"); openPrivButton ("2ndtest_buttons4",$HFR,$HFD+20,$BRW,$BRHS,$TBS,$TBT,4,"4 - combined text and button colour"); openPrivButton ("2ndtest_buttons5",$HFR,$HFD+25,$BRW,$BRHS,$TBS,$TBT,5,"5 - combined text and button colour"); openPrivButton ("2ndtest_buttons6",$HFR,$HFD+30,$BRW,$BRHS,$TBS,$TBT,6,"6 - combined text and button colour"); openPrivButton ("2ndtest_buttons7",$HFR,$HFD+35,$BRW,$BRHS,$TBS,$TBT,7,"7 - combined text and button colour"); openPrivButton ("2ndtest_buttons8",$HFR+40,$HFD,$BRW,$BRHS,$TBS,$TBT,8,"8 - combined text and button colour"); openPrivButton ("2ndtest_buttons9",$HFR+40,$HFD+5,$BRW,$BRHS,$TBS,$TBT,9,"9 - combined text and button colour"); openPrivButton ("2ndtest_buttons10",$HFR+40,$HFD+10,$BRW,$BRHS,$TBS,$TBT,10,"10 - combined text and button colour"); openPrivButton ("2ndtest_buttons11",$HFR+40,$HFD+15,$BRW,$BRHS,$TBS,$TBT,11,"11 - combined text and button colour"); openPrivButton ("2ndtest_buttons12",$HFR+40,$HFD+20,$BRW,$BRHS,$TBS,$TBT,12,"12 - combined text and button colour"); openPrivButton ("2ndtest_buttons13",$HFR+40,$HFD+25,$BRW,$BRHS,$TBS,$TBT,13,"13 - combined text and button colour"); openPrivButton ("2ndtest_buttons14",$HFR+40,$HFD+30,$BRW,$BRHS,$TBS,$TBT,14,"14 - combined text and button colour"); openPrivButton ("2ndtest_buttons15",$HFR+40,$HFD+35,$BRW,$BRHS,$TBS,$TBT,15,"15 - combined text and button colour"); openPrivButton ("2ndtest_buttons16",$HFR,$HFD+45,$BRW,$BRHS,$TBS,$TBT,16,"16 - combined text and button colour"); openPrivButton ("2ndtest_buttons17",$HFR,$HFD+50,$BRW,$BRHS,$TBS,$TBT,17,"17 - combined text and button colour"); openPrivButton ("2ndtest_buttons18",$HFR,$HFD+55,$BRW,$BRHS,$TBS,$TBT,18,"18 - combined text and button colour"); openPrivButton ("2ndtest_buttons19",$HFR,$HFD+60,$BRW,$BRHS,$TBS,$TBT,19,"19 - combined text and button colour"); openPrivButton ("2ndtest_buttons20",$HFR,$HFD+65,$BRW,$BRHS,$TBS,$TBT,20,"20 - combined text and button colour"); openPrivButton ("2ndtest_buttons21",$HFR,$HFD+70,$BRW,$BRHS,$TBS,$TBT,21,"21 - combined text and button colour"); openPrivButton ("2ndtest_buttons22",$HFR,$HFD+75,$BRW,$BRHS,$TBS,$TBT,22,"22 - combined text and button colour"); openPrivButton ("2ndtest_buttons23",$HFR,$HFD+80,$BRW,$BRHS,$TBS,$TBT,23,"23 - combined text and button colour"); openPrivButton ("2ndtest_buttons24",$HFR+40,$HFD+45,$BRW,$BRHS,$TBS,$TBT,24,"24 - combined text and button colour"); openPrivButton ("2ndtest_buttons25",$HFR+40,$HFD+50,$BRW,$BRHS,$TBS,$TBT,25,"25 - combined text and button colour"); openPrivButton ("2ndtest_buttons26",$HFR+40,$HFD+55,$BRW,$BRHS,$TBS,$TBT,26,"26 - combined text and button colour"); openPrivButton ("2ndtest_buttons27",$HFR+40,$HFD+60,$BRW,$BRHS,$TBS,$TBT,27,"27 - combined text and button colour"); openPrivButton ("2ndtest_buttons28",$HFR+40,$HFD+65,$BRW,$BRHS,$TBS,$TBT,28,"28 - combined text and button colour"); openPrivButton ("2ndtest_buttons29",$HFR+40,$HFD+70,$BRW,$BRHS,$TBS,$TBT,29,"29 - combined text and button colour"); openPrivButton ("2ndtest_buttons30",$HFR+40,$HFD+75,$BRW,$BRHS,$TBS,$TBT,30,"30 - combined text and button colour"); openPrivButton ("2ndtest_buttons31",$HFR+40,$HFD+80,$BRW,$BRHS,$TBS,$TBT,31,"31 - combined text and button colour"); openPrivButton ("2ndtest_buttons32",$HFR,$HFD+90,$BRW,$BRHS,$TBS,$TBT,32,"32 - combined text and button colour"); openPrivButton ("2ndtest_buttons33",$HFR,$HFD+95,$BRW,$BRHS,$TBS,$TBT,33,"33 - combined text and button colour"); openPrivButton ("2ndtest_buttons34",$HFR,$HFD+100,$BRW,$BRHS,$TBS,$TBT,34,"34 - combined text and button colour"); openPrivButton ("2ndtest_buttons35",$HFR,$HFD+105,$BRW,$BRHS,$TBS,$TBT,35,"35 - combined text and button colour"); openPrivButton ("2ndtest_buttons36",$HFR,$HFD+110,$BRW,$BRHS,$TBS,$TBT,36,"36 - combined text and button colour"); openPrivButton ("2ndtest_buttons37",$HFR,$HFD+115,$BRW,$BRHS,$TBS,$TBT,37,"37 - combined text and button colour"); openPrivButton ("2ndtest_buttons38",$HFR,$HFD+120,$BRW,$BRHS,$TBS,$TBT,38,"38 - combined text and button colour"); openPrivButton ("2ndtest_buttons39",$HFR,$HFD+125,$BRW,$BRHS,$TBS,$TBT,39,"39 - combined text and button colour"); openPrivButton ("2ndtest_buttons40",$HFR+40,$HFD+90,$BRW,$BRHS,$TBS,$TBT,40,"40 - combined text and button colour"); openPrivButton ("2ndtest_buttons41",$HFR+40,$HFD+95,$BRW,$BRHS,$TBS,$TBT,41,"41 - combined text and button colour"); openPrivButton ("2ndtest_buttons42",$HFR+40,$HFD+100,$BRW,$BRHS,$TBS,$TBT,42,"42 - combined text and button colour"); openPrivButton ("2ndtest_buttons43",$HFR+40,$HFD+105,$BRW,$BRHS,$TBS,$TBT,43,"43 - combined text and button colour"); # numbers above 43 give same result OpenPrivButton ("test_buttonclose",$HFR-95,$HFD+166,60,$BRHS+1,5,$TBT,35,"I want some of these buttons to close",firstset); OpenPrivButton ("testall_buttonsclose",$HFR-95,$HFD+172,60,$BRHS+1,5,$TBT,37,"I want most of these buttons to close",twosets); EndSub ############# This section is for the subs to close buttons ############# Sub firstset ($KeyFlags,$id) closeButtonRegex (GetCurrentPlayerVar("UserName"), "test_*"); EndSub Sub twosets ($KeyFlags,$id) closeButtonRegex (GetCurrentPlayerVar("UserName"), "test_*"); closeButtonRegex (GetCurrentPlayerVar("UserName"), "2ndtest_*"); ClosePrivButton ("testall_buttonclose"); EndSub Sub DoSomething ($KeyFlags,$id) closePrivButton("my_button&my_button2"); EndSub # Language section - where there is no translation other than English, then the English translation will be used Lang "EN" # English Greeting = "^3Greetings"; red_flag = "^1|"; black_flag = "^0|"; yellow_flag = "^3|"; EndLang Lang "FR" # French Greeting = "^3Les salutations"; EndLang Lang "NO" # Norwegian Greeting = "^3hilsener"; EndLang Lang "IT" # Italian Greeting = "^3I saluti"; EndLang Lang "NL" # Dutch Greeting = "^3De groeten "; EndLang