16
Technical forum / Re: Mouseentry loops?
« on: August 24, 2011, 11:18:59 AM »
Thanks Mnemonic. Sorry I didn't get it the first time. I get it now. Cheers for the help.
IRC channel - server: waelisch.de channel: #wme (read more)
#include "scripts\base.inc"
#include "scripts\keys.inc"
// I AM INTROMENU
this.xResult = false;
var BeenHere = Game.IsSaveSlotUsed(0);
if(BeenHere != true)
{
// Initialize system
var RegKeyName;
Game.RegWriteNumber("PlayerNum", null);
Game.RegWriteNumber("PlayerCurrent", null);
for(var t = 1; t<7; t = t+1);
{
RegKeyName = "Player"+t;
Game.RegWriteString(RegKeyName, null);
}
Game.SaveGame(0, "SystemSave");
}
var PlayerName = this.GetControl("PlayerName");
// Find out who's playing and update this menu for current and player list for profile changes
Player.Num = Game.RegReadNumber("PlayerNum");
if(Player.Num == null)
{
Player.Num = 0;
Game.RegWriteNumber("PlayerNum", Player.Num);
}
else
{
Player.Num = Game.RegReadNumber("PlayerNum");
}
if(Player.Num > 0)
{
// Get already registered players
Player.Current = Game.RegReadNumber("PlayerCurrent");
// Initialise list
for(var a = 1; a <7; a = a+1)
{
Player[a] = null;
}
// Repopulate list
for(a = 1; a < Player.Num +1; a = a + 1)
{
RegKeyName = "Player" + a;
Player[a] = Game.RegReadString(RegKeyName);
}
DoPlayer();
}
function DoPlayer()
{
var dp = Player.Current;
PlayerName.Text = Game.ExpandString("/IM_PlayerName/")+" "+Player[dp];
PlayerName.Visible = true;
var ChangeProfile = this.GetControl("ChangeProfile");
ChangeProfile.Visible = true;
ChangeProfile.Disabled = false;
}
on "Play"
{
// If we don't have any players, create one
this.PlaySound("ui_elements\GenMoveClick.ogg");
if(Player.Num == 0)
{
NewPlayer = Game.LoadWindow("interface\IntroMenu\NewPlayer.window");
NewPlayer.GoExclusive();
while(NewPlayer != null)
{
Sleep(20);
}
DoPlayer();
}
else
{
Game.LoadGame(Player.Current);
}
}
on "Options"
{
this.PlaySound("ui_elements\GenMoveClick.ogg");
Game.Msg("No options yet");
}
on "Credits"
{
this.PlaySound("ui_elements\GenMoveClick.ogg");
Game.Msg("No credits yet");
}
on "Exit"
{
// ARE YOU SURE?
this.PlaySound("ui_elements\GenMoveClick.ogg");
var qg = Game.LoadWindow("interface\IntroMenu\QuitSure.window");
}
on "ChangeProfile"
{
this.PlaySound("ui_elements\GenMoveClick.ogg");
var PlayerList = Game.LoadWindow("interface\IntroMenu\PlayerList.window");
if(Player.Changed == true)
{
Player.Changed = null;
DoPlayer();
}
}
////////////////////////////////////////////////////////////////////////////////
on "close"
{
this.Close();
}
////////////////////////////////////////////////////////////////////////////////
on "yes"
{
this.xResult = true;
this.Close();
}
////////////////////////////////////////////////////////////////////////////////
on "Keypress"
{
var button;
if(Keyboard.KeyCode==VK_ESCAPE)
{
button = this.GetControl("close");
button.Press();
}
else if(Keyboard.KeyCode==VK_RETURN)
{
// button = this.GetControl("yes");
// button.Press();
}
}
#include "scripts\base.inc"
#include "scripts\keys.inc"
// I AM PLAYERLIST
this.xResult = false;
for(var w = 1024; w > 512; w = w - 32)
{
this.X = w;
Sleep(20);
}
Player.Was = Player.Current;
InitButtons();
NoDelete();
NoNew();
this.GoExclusive();
function InitButtons()
{
Game.Interactive = false;
for(var ib = 1; ib < 7; ib = ib + 1)
{
//Initialize buttons
var ic = this.GetControl(ib);
Game.Msg("ic is "+ic);
ic.Text = "";
ic.Disabled = true;
ic.Visible = false;
}
for(ib = 1; ib < Player.Num+1; ib = ib+1)
{
ic = this.GetControl(ib);
ic.Text = Player[ib];
ic.Disabled = false;
ic.Visible = true;
if(Player.Current == ib)
{
ic.SetFont("fonts\Arial20BoldRed.font");
}
else
{
ic.SetFont("fonts\arial20.font");
}
}
Game.Interactive = true;
}
function NoDelete()
{
Game.Interactive = false;
var d = this.GetControl("Delete");
if(Player.Current == 1)
{
d.Disabled = true;
d.Visible = true;
d.SetFont=("fonts\arial20greyed.font");;
}
else
{
d.Disabled = false;
d.Visible = true;
d.SetFont("fonts\arial20.font");
}
Game.Interactive = true;
}
function NoNew()
{
Game.Interactive = false;
var n = this.GetControl("New");
if(Player.Num > 5)
{
n.Disabled = true;
n.Visible = true;
n.SetFont("fonts\arial20greyed.font");
}
else
{
n.Disabled = false;
n.Visible = true;
n.SetFont("fonts\arial20.font");
}
Game.Interactive = true;
}
function CloseThis()
{
Player.Was = null;
this.Close();
Game.UnloadObject(this);
}
////////////////////////////////////////////////////////////////////////////////
on "1"
{
this.PlaySound("ui_elements\GenMoveClick.ogg");
Player.Current = 1;
InitButtons();
}
on "2"
{
this.PlaySound("ui_elements\GenMoveClick.ogg");
Player.Current = 2;
InitButtons();
}
on "3"
{
this.PlaySound("ui_elements\GenMoveClick.ogg");
Player.Current = 3;
InitButtons();
}
on "4"
{
this.PlaySound("ui_elements\GenMoveClick.ogg");
Player.Current = 4;
InitButtons();
}
on "5"
{
this.PlaySound("ui_elements\GenMoveClick.ogg");
Player.Current = 5;
InitButtons();
}
on "6"
{
this.PlaySound("ui_elements\GenMoveClick.ogg");
Player.Current = 6;
InitButtons();
}
on "New"
{
this.PlaySound("ui_elements\GenMoveClick.ogg");
var fn = this.GetControl("New");
NewPlayer = Game.LoadWindow("interface\IntroMenu\NewPlayer.window");
NewPlayer.GoExclusive();
while(NewPlayer != null)
{
Sleep(20);
}
InitButtons();
NoDelete();
NoNew();
fn.Pressed = false;
}
on "Delete"
{
this.PlaySound("ui_elements\GenMoveClick.ogg");
var fd = this.GetControl("Delete");
var dw = Game.LoadWindow(""); // ARE YOU SURE?
if(dw == true)
{
Player.Changed = true;
for(var pd = Player.Current; pd < Player.Num; pd = pd + 1)
{
Player[pd] = Player[pd + 1];
var RegKeyName = "Player" + pd;
Game.RegWriteString(RegKeyName, Player[pd]);
}
var px = Player.Num;
RegKeyName = "Player"+Player.Num;
Player[px] = null;
Game.RegWriteString(RegKeyName, null);
Player.Num = Player.Num - 1;
Game.RegWriteNumber("PlayerNum", Player.Num);
InitButtons();
NoDelete();
NoNew();
}
dw.Pressed = false;
}
on "Continue"
{
this.PlaySound("ui_elements\GenMoveClick.ogg");
this.xResult = true;
CloseThis();
}
on "Cancel"
{
this.PlaySound("ui_elements\GenMoveClick.ogg");
if(Player.Current != Player.Was)
{
Player.Current = Player.Was;
InitButtons();
}
this.xResult = false;
CloseThis();
}
////////////////////////////////////////////////////////////////////////////////
on "Keypress"
{
var button;
if(Keyboard.KeyCode==VK_ESCAPE)
{
button = this.GetControl("close");
button.Press();
}
else if(Keyboard.KeyCode==VK_RETURN)
{
// button = this.GetControl("yes");
// button.Press();
}
}
#include "scripts\base.inc"
#include "scripts\keys.inc"
// I AM NEWPLAYER
this.xResult = false;
for(var w = 1024; w > 312; w = w - 64)
{
this.X = w;
Sleep(20);
}
///////////////////////////////////////////////////////////////////////////////
on "Cancel"
{
NewPlayer = null;
this.Close();
Game.UnloadObject(this);
}
////////////////////////////////////////////////////////////////////////////////
on "OK"
{
Game.Interactive = false;
var ed = this.GetControl("NameEditor");
var pn = ed.Text;
Game.Msg("Player is "+pn);
Player.Num = Player.Num+1;
Game.Msg("Player.Num is "+Player.Num);
var px = Player.Num;
Player[px] = pn;
Player.Current = px;
Player.Changed = true;
Game.RegWriteNumber("PlayerNum", Player.Num);
Game.RegWriteNumber("PlayerCurrent", Player.Current);
for(var a = 1; a < Player.Num +1; a = a +1)
{
var RegKeyName = "Player" + a;
Game.RegWriteString(RegKeyName, Player[a]);
}
Game.Interactive = true;
NewPlayer = null;
this.Close();
Game.UnloadObject(this);
}
////////////////////////////////////////////////////////////////////////////////
on "Keypress"
{
var button;
if(Keyboard.KeyCode==VK_ESCAPE)
{
button = this.GetControl("close");
button.Press();
}
else if(Keyboard.KeyCode==VK_RETURN)
{
// button = this.GetControl("yes");
// button.Press();
}
}
on "New"
{
this.PlaySound("ui_elements\GenMoveClick.ogg");
var fn = this.GetControl("New");
NewPlayer = Game.LoadWindow("interface\IntroMenu\NewPlayer.window");
NewPlayer.GoExclusive();
while(NewPlayer != null)
{
Sleep(20);
}
InitButtons();
NoDelete();
NoNew();
fn.Pressed = false;
}
on "Play"
{
// If we don't have any players, create one
this.PlaySound("ui_elements\GenMoveClick.ogg");
if(Player.Num == 0)
{
NewPlayer = Game.LoadWindow("interface\IntroMenu\NewPlayer.window");
NewPlayer.GoExclusive();
while(NewPlayer != null)
{
Sleep(20);
}
DoPlayer();
}
else
{
Game.LoadGame(Player.Current);
}
}
on "OK"
{
Game.Interactive = false;
var ed = this.GetControl("NameEditor");
var pn = ed.Text;
Game.Msg("Player is "+pn);
Player.Num = Player.Num+1;
Game.Msg("Player.Num is "+Player.Num);
var px = Player.Num;
Player[px] = pn;
Player.Current = px;
Player.Changed = true;
Game.RegWriteNumber("PlayerNum", Player.Num);
Game.RegWriteNumber("PlayerCurrent", Player.Current);
for(var a = 1; a < Player.Num +1; a = a +1)
{
var RegKeyName = "Player" + a;
Game.RegWriteString(RegKeyName, Player[a]);
}
Game.Interactive = true;
NewPlayer = null;
this.Close();
Game.UnloadObject(this);
}