Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- @name CPU
- @inputs Ping_in CPU_CAN_WRITE Screen:wirelink Key TZ_in Power
- @outputs Ping_out T1:array
- @persist Time S ST Clr Col Userfound S_X Select AryPosU AryPosP
- @persist AryPos [User Pass User_db Pass_db Buffer]:array BufferPos
- @persist StartMenu Select2 [Hour Minute]:string Real_Time TempTime
- @trigger
- ###################
- # TIMER #
- ###################
- interval(500)
- if(clk())
- {
- if(ST == 1)
- {
- Time+=1
- if(Time<9)
- {
- Col++
- }
- S_X+=3
- }
- }
- T = Time
- ###################
- if(Ping_in == 1) #
- { #
- Ping_out = 1 #
- } #
- else #
- { #
- Ping_out = 0 #
- } #
- ###################
- if(~CPU_CAN_WRITE)
- {
- Screen:writeCell(2041,1)
- ST = 0
- Time = 0
- S = 0
- Col = 0
- S_X = 0
- Select = 0
- AryPosU = 1
- AryPosP = 1
- Clr = 0
- AryPos = 1
- Userfound = 0
- StartScreen = 0
- Select2 = 0
- StartMenu = 0
- BufferPos = 1
- while(User[AryPos,string] != "")
- {
- User:remove(1)
- }
- AryPos = 1
- while(Pass[AryPos,string] != "")
- {
- Pass:remove(1)
- }
- while(Buffer[AryPos,string] != "")
- {
- Pass:remove(1)
- }
- AryPos = 1
- ##########################
- # User / Pass db #
- ##########################
- User_db[1,string] = "assassin"
- Pass_db[1,string] = "root"
- ##############################
- }
- if(CPU_CAN_WRITE & Power == 1)
- {
- ########################
- # Start Screen #
- ########################
- if(S == 0)
- {
- ST = 1
- if(Time < 10)
- {
- Screen:writeString("Assassin",11,7,Col+(Col*10)+(Col*100),0,0)
- Screen:writeString(" ",S_X,17,555,555,0)
- }
- if(Time > 10)
- {
- Screen:writeString(" Press Any Key To Continue! ",0,17,6,666,0)
- if(Key)
- {
- ST = 0
- Time = 0
- Clr = 1
- S = 1
- }
- }
- }
- #####################
- # Main Menu #
- #####################
- if(S == 1)
- {
- if(!clk())
- {
- if(Clr)
- {
- Screen:writeCell(2041,1)
- Clr = 0
- }
- else
- {
- Screen:writeString("LOGIN:",12,5,999,0,0)
- if(Key == 17)
- {
- Select = 0
- }
- if(Key == 18)
- {
- Select = 1
- }
- if(Select == 0)
- {
- Screen:writeString("User:",3,8,999,0,0)
- Screen:writeString("Pass:",3,9,559,0,0)
- }
- if(Select == 1)
- {
- Screen:writeString("User:",3,8,559,0,0)
- Screen:writeString("Pass:",3,9,999,0,0)
- }
- if(Key & Key != 154 & Key != 19 & Key != 20 & Key != 17 & Key != 18 & Key != 127 & Key != 9 & Key != 13 & Select == 0)
- {
- User[AryPosU,string] = toChar(Key)
- Screen:writeString(User[AryPosU,string],AryPosU+9,8,999,0,0)
- AryPosU++
- }
- if(Key & Key != 154 & Key != 19 & Key != 20 & Key != 17 & Key != 18 & Key != 127 & Key != 9 & Key != 13& Select == 1)
- {
- Pass[AryPosP,string] = toChar(Key)
- Screen:writeString("*",AryPosP+9,9,999,0,0)
- AryPosP++
- }
- if(Key == 127)
- {
- if(Select == 0)
- {
- User:remove(AryPosU-1)
- Screen:writeString(" ",AryPosU+8,8,999,0,0)
- if(AryPosU != 1)
- {
- AryPosU--
- }
- }
- if(Select == 1)
- {
- Pass:remove(AryPosP-1)
- Screen:writeString(" ",AryPosP+8,9,999,0,0)
- if(AryPosP != 1)
- {
- AryPosP--
- }
- }
- }
- if(Key == 13)
- {
- AryPos = 1
- while(User_db[AryPos,string] != "" & Userfound == 0)
- {
- if(User_db[AryPos,string] == User:concat())
- {
- Userfound = AryPos
- break
- }
- AryPos++
- }
- if(User_db[AryPos,string] == "")
- {
- Screen:writeString("USERNAME NOT FOUND",6,11,900,0,0)
- }
- }
- if(Userfound)
- {
- if(Pass_db[Userfound,string] == Pass:concat())
- {
- S = 2
- }
- if(Pass_db[Userfound,string] != Pass:concat())
- {
- Screen:writeString("INCORRECT PASSWORD",6,11,900,0,0)
- }
- }
- }
- }
- }
- if(S == 2)
- {
- Screen:writeString(Hour+":"+Minute,25,17,999,9,0)
- if(!clk())
- {
- Screen:writeCell(2041,1)
- Screen:writeString(" ",0,17,9,9,0)
- Screen:writeString("CTRL",0,17,999,60,0)
- Screen:writeString(Hour+":"+Minute,25,17,999,9,0)
- if(Key == 158 & StartMenu == 0)
- {
- StartMenu = 1
- ST = 1
- }
- if(Time > 1 & Key == 158 & StartMenu == 1)
- {
- StartMenu = 0
- ST = 0
- Time = 0
- }
- if(StartMenu == 1)
- {
- for(Y=12,16)
- {
- for(X=1,8)
- {
- Screen:writeString(" ",X,Y,777,777,0)
- }
- }
- for(Y=8,16)
- {
- Screen:writeString(" ",0,Y,555,555,0)
- Screen:writeString(" ",9,Y,555,555,0)
- }
- Screen:writeString(" ",0,8,555,555,0)
- Screen:writeString("My Files",1,9,222,777,0)
- Screen:writeString("My Music",1,10,222,777,0)
- Screen:writeString("Word Pad",1,11,222,777,0)
- Screen:writeString("CMD Line",1,12,222,777,0)
- Screen:writeString("Run Prog",1,13,222,777,0)
- }
- if(StartMenu == 0)
- {
- for(Y=9,16)
- {
- for(X=1,8)
- {
- Screen:writeString(" ",X,Y,0,0,0)
- }
- }
- for(Y=8,16)
- {
- Screen:writeString(" ",0,Y,0,0,0)
- Screen:writeString(" ",9,Y,0,0,0)
- }
- Screen:writeString(" ",0,8,0,0,0)
- }
- if(StartMenu == 1)
- {
- if(Key == 18)
- {
- if(Select2 != 0)
- {
- Select2--
- }
- }
- if(Key == 17)
- {
- if(Select2 != 4)
- {
- Select2++
- }
- }
- }
- if(StartMenu == 1)
- {
- if(Select2 == 4)
- {
- Screen:writeString("My Files",1,9,222,557,0)
- }
- if(Select2 == 3)
- {
- Screen:writeString("My Music",1,10,222,557,0)
- }
- if(Select2 == 2)
- {
- Screen:writeString("Word Pad",1,11,222,557,0)
- }
- if(Select2 == 1)
- {
- Screen:writeString("CMD Line",1,12,222,557,0)
- }
- if(Select2 == 0)
- {
- Screen:writeString("Run Prog",1,13,222,557,0)
- }
- }
- if(StartMenu == 1 & Select2 == 0 & Key == 13)
- {
- ST = 0
- Time = 0
- Clr = 1
- S = 3
- }
- if(StartMenu == 1 & Select2 == 1 & Key == 13)
- {
- ST = 0
- Time = 0
- Clr = 1
- S = 4
- }
- if(StartMenu == 1 & Select2 == 2 & Key == 13)
- {
- ST = 0
- Time = 0
- Clr = 1
- S = 5
- }
- if(StartMenu == 1 & Select2 == 3 & Key == 13)
- {
- ST = 0
- Time = 0
- Clr = 1
- S = 6
- }
- if(StartMenu == 1 & Select2 == 4 & Key == 13)
- {
- ST = 0
- Time = 0
- Clr = 1
- S = 7
- }
- }
- }
- ####################
- # Run Prog #
- ####################
- if(S == 3)
- {
- Screen:writeString(Hour+":"+Minute,25,17,999,9,0)
- if(!clk())
- {
- Screen:writeCell(2041,1)
- Screen:writeString(Hour+":"+Minute,25,17,999,9,0)
- Screen:writeString(" ",0,17,9,9,0)
- Screen:writeString("CTRL",0,17,999,444,0)
- }
- }
- ####################
- # CMD Line #
- ####################
- if(S == 4)
- {
- Screen:writeString(Hour+":"+Minute,25,17,999,9,0)
- if(!clk())
- {
- Screen:writeCell(2041,1)
- Screen:writeString(Hour+":"+Minute,25,17,999,9,0)
- Screen:writeString(" ",0,17,9,9,0)
- Screen:writeString("CTRL",0,17,999,444,0)
- }
- }
- ####################
- # Word Pad #
- ####################
- if(S == 5)
- {
- if(!clk())
- {
- Screen:writeString(Hour+":"+Minute,25,17,999,9,0)
- Screen:writeCell(2041,1)
- Screen:writeString(Hour+":"+Minute,25,17,999,9,0)
- Screen:writeString(" ",0,17,9,9,0)
- Screen:writeString("CTRL",0,17,999,444,0)
- }
- }
- ####################
- # My Music #
- ####################
- if(S == 6)
- {
- Screen:writeString(Hour+":"+Minute,25,17,999,9,0)
- if(!clk())
- {
- if(Clr)
- {
- Screen:writeCell(2041,1)
- Clr = 0
- }
- ST = 1
- Screen:writeString(Hour+":"+Minute,25,17,999,9,0)
- Screen:writeString(" ",0,17,9,9,0)
- Screen:writeString("CTRL",0,17,999,444,0)
- if(Time == 0)
- {
- for(X=2,27)
- {
- Screen:writeString(" ",X,2,999,999,0)
- Screen:writeString(" ",X,15,999,999,0)
- }
- Screen:writeString(" My Music [TAB] ",2,1,999,357,0)
- for(Y=2,15)
- {
- Screen:writeString(" ",2,Y,999,999,0)
- Screen:writeString(" ",27,Y,999,999,0)
- }
- for(Y=3,14)
- {
- for(X=3,26)
- {
- Screen:writeString(" ",X,Y,555,555,0)
- }
- }
- Screen:writeString(" ",10,5,9,333,0)
- Screen:writeString("SONG:",5,5,9,555,0)
- }
- if(Key & Key != 154 & Key != 19 & Key != 20 & Key != 17 & Key != 18 & Key != 127 & Key != 9 & Key != 13)
- {
- Buffer[BufferPos,string] = toChar(Key)
- if(BufferPos < 14)
- {
- Screen:writeString(toChar(Key),BufferPos+9,5,999,333,0)
- }
- BufferPos++
- }
- if(Key & Key == 127)
- {
- if(BufferPos != 1)
- {
- BufferPos--
- Buffer[BufferPos,string] = ""
- Screen:writeString(" ",BufferPos+9,5,999,333,0)
- }
- }
- if(Key & Key == 13)
- {
- soundPlay(0,10000,Buffer:concat())
- }
- if(Key == 9)
- {
- StartMenu = 0
- ST = 0
- Time = 0
- S = 2
- }
- }
- }
- ####################
- # My Files #
- ####################
- if(S == 7)
- {
- Screen:writeString(Hour+":"+Minute,25,17,999,9,0)
- if(!clk())
- {
- Screen:writeCell(2041,1)
- Screen:writeString(Hour+":"+Minute,25,17,999,9,0)
- Screen:writeString(" ",0,17,9,9,0)
- Screen:writeString("CTRL",0,17,999,444,0)
- }
- }
- }
- if(0)
- {
- print(Buffer)
- }
- ##################################################
- Real_Time = (time("hour")+TZ_in)
- if(Real_Time <= 9)
- {
- Hour = "0"+toString(Real_Time)
- }
- if(Real_Time >= 10 & Real_Time < 12)
- {
- Hour = toString(Real_Time)
- }
- if(Real_Time > 12)
- {
- if(Real_Time-12 <= 9)
- {
- Hour = "0"+toString((Real_Time-12))
- }
- if(Real_Time-12 >= 10)
- {
- Hour = toString((Real_Time-12))
- }
- }
- if(Real_Time-12 < 0)
- {
- TempTime = (time("hour")-12)
- Hour = toString(((12-TempTime)-12))
- }
- if(time("min") < 10)
- {
- Minute = "0"+toString(time("min"))
- }
- if(time("min") > 10)
- {
- Minute = toString(time("min"))
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement