@@ -305,7 +305,7 @@ enum controlType
305305 #region EZCode_Script_Player
306306 Method ? currentmethod = null ;
307307 string returnOutput = "" ;
308- bool devDisplay = true , lastif = true ;
308+ bool devDisplay = true , lastif = true , restart = false ;
309309 int devportal = 0 , ifmany = 0 , loopmany = 0 ;
310310 async Task < string [ ] > PlaySwitch ( string [ ] ? _parts = null , string jumpsto = "" , string [ ] ? splitcode = null , int currentindex = 0 , Debugger ? debugger = null )
311311 {
@@ -1028,6 +1028,10 @@ async Task<string[]> PlaySwitch(string[]? _parts = null, string jumpsto = "", st
10281028 case "return" :
10291029 stillInFile = false ;
10301030 break ;
1031+ case "restart" :
1032+ playing = false ;
1033+ restart = true ;
1034+ break ;
10311035 default :
10321036 ErrorText ( parts , ErrorTypes . custom , custom : $ "Expected 'all' or 'return' in { SegmentSeperator } { codeLine } ") ;
10331037 break ;
@@ -3446,7 +3450,7 @@ string ColonResponse(string value, string[] parts = null)
34463450 Random rand = new Random ( ) ;
34473451 try
34483452 {
3449- value = rand . Next ( v1 , v2 - 1 ) . ToString ( ) ;
3453+ value = rand . Next ( v1 , v2 + 1 ) . ToString ( ) ;
34503454 }
34513455 catch
34523456 {
@@ -3898,11 +3902,17 @@ string ColonResponse(string value, string[] parts = null)
38983902 }
38993903 break ;
39003904 case "contains" :
3901- if ( ind . Length > 2 )
3905+ value = var . Description == Types . Array ? var . array . Length . ToString ( ) : var . text . Length . ToString ( ) ;
3906+ if ( ind . Length > 2 && ! var . isArray ( ) )
39023907 {
39033908 string v = ind [ 2 ] ;
39043909 value = var . Value . Contains ( v ) ? "1" : "0" ;
39053910 }
3911+ else if ( ind . Length > 2 && var . isArray ( ) )
3912+ {
3913+ string [ ] v = getString_value ( ind , 2 , usecolon : false ) ;
3914+ value = var . Value . Contains ( v [ 0 ] ) ? "1" : "0" ;
3915+ }
39063916 else
39073917 {
39083918 ErrorText ( parts , ErrorTypes . custom , custom : $ "Expected a value to check in '{ ind [ 0 ] } :{ ind [ 1 ] } ' for in { SegmentSeperator } { codeLine } ") ;
@@ -5190,7 +5200,15 @@ public async Task<string> Play(string code, bool clearsconsole = true, Debugger?
51905200
51915201 for ( int i = 0 ; i < lines . Count ; i ++ )
51925202 {
5193- if ( ! playing ) return output ;
5203+ if ( ! playing )
5204+ {
5205+ if ( restart )
5206+ {
5207+ restart = false ;
5208+ await Play ( Code , false ) ;
5209+ }
5210+ return output ;
5211+ }
51945212 codeLine = i + 1 ;
51955213 List < string > parts = lines [ i ] . Split ( new char [ ] { ' ' } ) . Where ( x => x != "" ) . ToList ( ) ;
51965214 for ( int j = 0 ; j < parts . Count ; j ++ )
@@ -5214,6 +5232,11 @@ public async Task<string> Play(string code, bool clearsconsole = true, Debugger?
52145232 output += task [ 0 ] ;
52155233 ConsoleText = output ;
52165234 }
5235+ if ( restart )
5236+ {
5237+ restart = false ;
5238+ await Play ( Code , false ) ;
5239+ }
52175240 if ( playing ) playing = false ;
52185241 StopAllSounds ( ) ;
52195242 return output ;
@@ -5241,6 +5264,8 @@ public async Task<string> PlayFromProj(EZProj proj)
52415264 public void Stop ( )
52425265 {
52435266 _pplaying = false ;
5267+ restart = false ;
5268+ playing = false ;
52445269 returnOutput = "" ;
52455270 devDisplay = true ;
52465271 devportal = 0 ;
0 commit comments