SCENE 2241, black, CUT, "Virtual Scene Interactive Development Enviornment", 0, 0, 0

	SET num.devTableId, "91"
	SET str.devTableRowId, "devvers"
	SET index, 0
@vscheckIDloop
		ADD index, 1
		PUSH str.devTableCOL#<index>
		POP value
		STRCMP #<value>, #<str.soul>
		IF= @vscheckIDdone
		COMPARE #<index>, 32
		IF< @vscheckIDloop
		GOTO @gotoexit
@vscheckIDdone

	COMPARE #<VSpreview>, "1"
	IF= @programreturn
	IF> @console

	;At this point, I'm just setting all the buggerish internal cookies needed for smooth operation, but only for first-timers.
	;It's a pain, trust me.  You try it sometime.
	;That conditional will change to whatever is needed if I update that list.
	;It's an easy way to make sure that what they have is the latest version of the cookies, but ensures that they are set only once.
	COMPARE #<used0>, "0"
	IF!= @setcookies
@setcookiesreturn

	N: Welcome to the Virtual Scene IDE.

	
	SET str.devTableRowId, sceneVS
	SET vscount, #<str.devTableCOL1>
	SET str.devTableRowId, sceneLBVS
	SET lbvscount, #<str.devTableCOL2>
	SET str.devTableRowId, "AdvOpt"
	SET VSadvcolor, "#<str.devTableCOL1>"
	COMPARE VSadvcolor, "0"
	IF!= @end
	SET VSadvcolor, "22"

@program
	;Choose a location to save to (mode x-2)
	SET currmode, "1-2"
	COMPARE #<vscount>, 1
	IF>= @arevsscenes
	COMPARE #<lbvscount>, 1
	IF>= @arelbvsscenes
	ACTOR 0, "Local Scene", VSbuttons, 13, -20, 50, 0
	ACTOR 3, "Exit", VSbuttons, 14, 50, 120, 0
	SET vs0x, 50
	SET vs1x, -100
	SET vs2x, -100
	MOVE 0, 50, 50, 4
	WAIT 0.5
	MOVE 3, 50, 75, 4
	WAIT 1.0
	END
@programstart
;(Mode 1)
	SET vsstartactor, "1"
	SET commandcurr, "1"
	SET vsguicommand, "0"
@programreturn
	SET currmode, "1"
	CALL 2240@clearactors
	N: Scene Composition Mode Active.
;	ACTOR 0-6, "existingcommandslist"
;	ACTOR 7-20, "newcommandslist"
;	ACTOR 40, "Menu", VSbuttons2, 0, 50, 76, 22 ;lets the user switch to console mode or exit.
	ACTOR 41, "Help", VSbuttons2, 1, 15, 100 ;lets the user access the help stuff.
	ACTOR 43, "Save Scene", VSbuttons, 15, 50, 90 ;lets the user save scenes to hard disk as cookies and label them
	ACTOR 44, "Load Scene", VSbuttons, 16, 50, 97 ;lets the user load scenes from their hard disk as cookies and use them (Mode x-2)
	ACTOR 45, "New Command Mode", VSbuttons, 14, 90, 41, 22 ;Switches between most-used and alphabetical
	ACTOR 47, "Up One Row", VSbuttons, 4, 90, 20 ;moves the command list up a command
	ACTOR 48, "Down One Row", VSbuttons, 5, 90, 69 ;moves the command list down a command
	ACTOR 49, "Up Six Rows", VSbuttons, 6, 90, 34 ;moves the command list up a set
	ACTOR 50, "Down Six Rows", VSbuttons, 7, 90, 55 ;moves the command list down a set
	ACTOR 51, "Add Command", VSbuttons, 0, 50, 20  ;activates command selection mode (Mode x-3)
	ACTOR 52, "Edit Command", VSbuttons, 1, 50, 27 ;activates selection mode, then activates command selection mode  (Mode x-4)
	ACTOR 53, "Insert Command", VSbuttons, 2, 50, 34 ;activates selection mode, then activates command selection mode, then re-aligns commands +  (Mode x-5)
	ACTOR 54, "Remove Command", VSbuttons, 3, 50, 41 ;activates selection mode, then re-aligns commands. -  (Mode x-6)
	ACTOR 55, "Up One", VSbuttons, 4, 10, 20 ;moves the list up a command
	ACTOR 56, "Down One", VSbuttons, 5, 10, 69 ;moves the list down a command
	ACTOR 57, "Up Six", VSbuttons, 6, 10, 34 ;moves the list up a set
	ACTOR 58, "Down Six", VSbuttons, 7, 10, 55 ;moves the list down a set
	ACTOR 59, "Jump To Label", VSbuttons, 8, 10, 41 ;scans list for a label
	ACTOR 60, "Output QUEST", VSbuttons, 9, 50, 55 ;prints QUEST from command cookies
	ACTOR 61, "Input QUEST", VSbuttons, 11, 50, 62 ;ASKs for strings to add to the end of the list of commands
	ACTOR 62, "Terminal Prompt", VSbuttons, 13, 90, 80, #<VSadvcolor> ;ASKs and interprets commands almost as if it were terminal.
	CALL 2240@drawvscommandlist #<vsstartactor>
	CALL 2240@drawvscommands #<vsstartaction>
	END

	#include TerminalShell.txt
	#include terminalshellvsplugin.txt

	END

	#include VSguiinputactions.txt

	END
	
@arevsscenes
	COMPARE #<lbvscount>, 1
	IF>= @arelbvsandvsscenes
	
	ACTOR 0, "Local Scene", VSbuttons, 13, -20, 50, 0
	ACTOR 1, "Remote Scene", VSbuttons, 13, 120, 50, 0
	ACTOR 3, "Exit", VSbuttons, 14, 50, 120, 0
	SET vs0x, 33
	SET vs1x, 66
	SET vs2x, -100
	MOVE 0, 33, 50, 4
	MOVE 1, 66, 50, 4
	WAIT 0.5
	MOVE 3, 50, 75, 4
	WAIT 1.0
	END
	
@arelbvsscenes
	ACTOR 0, "Local Scene", VSbuttons, 13, -20, 50, 0
	ACTOR 2, "Link-Based Remote Scene", VSbuttons, 13, 120, 50, 0
	ACTOR 3, "Exit", VSbuttons, 14, 50, 120, 0
	SET vs0x, 33
	SET vs1x, -100
	SET vs2x, 66
	MOVE 0, 33, 50, 4
	MOVE 2, 66, 50, 4
	WAIT 0.5
	MOVE 3, 50, 75, 4
	WAIT 1.0
	END

@arelbvsandvsscenes
	ACTOR 0, "Local Scene", VSbuttons, 13, -45, 50, 0
	ACTOR 1, "Remote Scene", VSbuttons, 13, -20, 50, 0
	ACTOR 2, "Link-Based Remote Scene", VSbuttons, 13, 120, 50, 0
	ACTOR 3, "Exit", VSbuttons, 14, 50, 120, 0
	SET vs0x, 25
	SET vs1x, 50
	SET vs2x, 75
	MOVE 0, 25, 50, 4
	MOVE 1, 50, 50, 4
	WAIT 0.5
	MOVE 2, 75, 50, 4
	MOVE 3, 50, 75, 4
	WAIT 1.0
	END

;Generates the list that can be rearranged, is mostly just pointers to the actual entries.
;This is useful for the second command list mode, where the most used commands show first.
@setcookies
	SET startactor, "1"
	SET startcommand, "1"
	SET vsstartaction, "1"
	SET currsave, "1"
	SET num.DevTableId, "90"
	SET str.DevTableRowId, "0"
	SET ucountnum, "#<str.DevTableCOL3>"
	SET currnum, "0"
	SET vsguiinc, "1"
@ucountsetloop
	SET vsguiused#<currnum>, "0"
	ADD currnum, "1"
	COMPARE #<currnum>, "#<ucountnum>"
	IF> @setcookiesreturn
	GOTO @ucountsetloop
	END


	#include VSeac.txt

END
@exit
	SET remotecat, ""
	SET remotevar, ""
	SET localdest, ""
	SET currmode, "0"
	SET VSpreview, "0"
	N: Exiting Virtual Scene IDE.
	N: Thank you for using Virtual Scenes.
	WAIT 2.0
	GOTO EXIT
	END

@end
END