Ha, that was simple enough! It all works like a dream now 
Thanks for the tips!
Oh, and sorry for being such a pain in the lower back

Thanks for the tips!
Oh, and sorry for being such a pain in the lower back

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.
Show posts Menu//.ash file
#define MAX_CLIENTS 2
struct Client {
String name;
String address;
int clientPhoto;
};
import Client clients[MAX_CLIENTS];
import function setupClients();
//.asc file
Client clients[MAX_CLIENTS];
int clientCount=0;
bool addClient(String name, String address)
{
if(clientCount+1 >= MAX_CLIENTS) // We've run out of array space, can't add any more
return false;
clients[clientCount].name = name;
clients[clientCount].address = address;
clientCount++;
}
void setupClients()
{
addClient("John Smith", "Burger Street");
addClient("Johnny Smith", "Ketchup is not down");
}
//Client Details
client[0].Name = "Smith John";
client[0].Photo = 28;
client[1].Name = "Bob the Builder";
client[1].Photo = 29;
//Client Details
clientName[0] = "Smith John";
clientPhoto[0] = 28;
clientName[1] = "Bob the Builder";
clientPhoto[1] = 29;
SetClient(0, "John Smith", 29, ...);
SetClient(1, "Johnny Smithy", 30, ...);
// ...
function ClientInfo()
{
//Client Details
clientName[0] = "Smith John";
clientPhoto[0] = 28;
clientName[1] = "Bob the Builder";
clientPhoto[1] = 29;
//etc...
Client[0]{
Name;
Photo;
Balance;
}
Client[1]{
Name;
Photo;
Balance;
}
//etc...
int chatOne;
String me, ma;
function room_Load()
{
player.y = 0;
chatOne = Chat.Create(btnChat, eFontFont3, 41);
me = "*Tom";
ma = "Jerry";
Chat.Prepare(chatOne, "12321321312321",me);
Chat.Prepare(chatOne, "vgdcvbdfbvdfbfbdfbdfb", ma);
Chat.Prepare(chatOne, "13213213213213213213", me);
Chat.Prepare(chatOne, "fgdfgdfgdfgdfgdfgda", ma);
Chat.Prepare(chatOne, "3423423", me);
}
function room_RepExec()
{
String lm, nm;
if (IsTimerExpired(1)) {
Chat.Advance(chatOne);
lm = Chat.GetLastMessage(chatOne);
nm = Chat.GetNextMessage(chatOne);
if (nm != null) SetTimer(1, (GetGameSpeed() * (lm.Length + nm.Length)) / 20);
else SetTimer(2, 80);
}
}
DynamicSprite* msgDS;
String msgText[50];
int msgIndex;
int textIndex;
int chatY;
export msgDS;
export msgText;
export msgIndex;
export textIndex;
export chatY;
//setting up the text strings
//called in on game_start
function msgReady() {
textIndex = 0;
while (textIndex < 49){
msgText[textIndex] = "123";
textIndex ++;
}
}
//if in repeatedly execute, it creates the abomination from the link above
//if in game_start just shows the AGS cup (default AGS image)
function msgChat(){
msgIndex = 0;
chatY = 0;
msgDS = DynamicSprite.Create(System.ViewportWidth, System.ViewportHeight);
DynamicSprite *windowSprite = DynamicSprite.CreateFromExistingSprite(msgDS.Graphic);
windowSprite.Crop(10, chatY, 10, 10);
gDynamic.BackgroundGraphic = windowSprite.Graphic;
DrawingSurface *surface = msgDS.GetDrawingSurface();
while (msgIndex < 49){
surface.DrawStringWrapped(10, msgIndex *10, 100, Game.NormalFont, eAlignLeft, msgText[msgIndex]);
msgIndex ++;
}
surface.Release();
windowSprite.Delete();
}
//called in on Game Start, global script
function msgChat(){
msgIndex = 0;
msgOn = 0;
Test = DynamicSprite.Create(200, 500);
Test.Crop(0, 0, 150, 50); //can't work out these numbers, but works oO
TestSurface = Test.GetDrawingSurface();
gDynamic.BackgroundGraphic = Test.Graphic;
while (msgOn < 49){
msgText[msgOn] = "123";
msgOn ++;
}
}
//triggered by a button
function msgChatRelease(){
if (dialogOn == false){
TestSurface.DrawingColor = 14;
while (chatCount < 49){
TestSurface.DrawStringWrapped(10, chatCount * 20, 200, Game.NormalFont, eAlignLeft, msgText[chatCount]);
chatCount ++;
}
}
dialogOn = true;
if (dialogOn == true){
TestSurface.Release();
}
}
if (gDynamic.Visible && gDynamic.Y > 0) gDynamic.Y -= 1;
DynamicSprite* msgDS[50]; //changed 50 DrawingSurfaces into 50 DynamicSprites
DrawingSurface* msgSurface;
int msgOn;
String msgText[50];
int msgIndex;
export msgDS;
export msgSurface;
export msgOn;
export msgText;
export msgIndex;
function msgChat(){
msgIndex = 0;
//sets up all of the DynamicSprites
//makes most sense to put it in Game Start, to set up the sprites inititally
while (msgIndex < 49){
msgDS[msgIndex] = DynamicSprite.Create(100, 50);
gDynamic.BackgroundGraphic = msgDS[msgIndex].Graphic; //Is this the problem? Can you have multiple DynamicSprites as one GUI background?
msgOn = 0;
msgText[msgOn] = "123"; //sets the reference for messages
msgSurface = msgDS[msgIndex].GetDrawingSurface();
msgSurface.DrawingColor = 14;
msgSurface.DrawStringWrapped(0, msgOn * 20, 200, Game.NormalFont, eAlignLeft, msgText[msgOn]);
msgIndex ++;
msgOn ++;
}
}
function msgChatRelease(){
if (msgText[msgOn] != "123"){ //if the messaged is changed, release the message
msgSurface.Release();
}
}
//separate script, changes the messages, releases them
//triggered through clicking a button
function Dialog01(){
msgText[0] = "Hii";
msgText[1] = "I know where you live";
msgText[2] = "Say goodbye to your fish";
msgChatRelease();
}
msgDS[msgOn].Crop(int x, int y, int width, int height);
DynamicSprite* msgDS;
DrawingSurface* msgSurface[50];
int msgOn; //to turning on different messages
String msgText[50];
export msgDS;
export msgSurface;
export msgOn;
export msgText;
//called in in Global Script, repeatedly_execute()
function msgChat(){
msgDS = DynamicSprite.Create(250, 400); //long Dynamic Sprite
gDynamic.BackgroundGraphic = msgDS.Graphic;
if (msgOn == 1){
msgSurface[0] = msgDS.GetDrawingSurface();
msgSurface[0].DrawingColor = 14;
msgSurface[0].DrawStringWrapped(0, 0, 200, Game.NormalFont, eAlignLeft, msgText[0]");
msgSurface[0].Release();
}
if (msgOn == 2){
msgSurface[1] = msgDS.GetDrawingSurface();
msgSurface[1].DrawingColor = 14;
msgSurface[1].DrawStringWrapped(0, 20, 200, Game.NormalFont, eAlignLeft, msgText[1]);
msgSurface[1].Release();
}
if (msgOn == 3){
msgSurface[2] = msgDS.GetDrawingSurface();
msgSurface[2].DrawingColor = 14;
msgSurface[2].DrawStringWrapped(0, 40, 200, Game.NormalFont, eAlignLeft, msgText[2]);
msgSurface[2].Release();
}
}
//In separate script, intended to be used as dialog editor
function Dialog01(){
msgText[0] = "Hii";
msgText[1] = "I know where you live";
msgText[2] = "Say goodbye to your fish";
}
//Button on click to trigger dialogue
Dialog01(); //changes the msgText strings
msgOn = 1; //supposed to trigger first msgText string
Wait(40); //supposed to wait before going to second line...
msgOn = 2;
String chatSay[100]; // I will probably never have 100 chat messages at once, but just in case...
bool messageOn[100];
export chatSay;
export messageOn;
//makes all labels invisible
// called in global script game_start() {
function ChatInfo(){
lblMessage1.Visible = false;
lblMessage2.Visible = false;
lblMessage3.Visible = false;
lblMessage4.Visible = false;
lblMessage5.Visible = false;
//defines all chatSay variables and messageOn bool
chatSay[0] = "";
chatSay[1] = "";
chatSay[2] = "";
chatSay[3] = "";
chatSay[4] = "";
messageOn[0] = false;
messageOn[1] = false;
messageOn[2] = false;
messageOn[3] = false;
messageOn[4] = false;
}
// setting up the chat labels
// called in global script repeatedly_execute()
function ChatLabels(){
lblMessage1.Text = chatSay[0];
lblMessage2.Text = chatSay[1];
lblMessage3.Text = chatSay[2];
lblMessage4.Text = chatSay[3];
lblMessage5.Text = chatSay[4];
}
// not the best way, it will require a lot of If statements :/
// called in global script repeatedly_execute()
function ChatMessage(){
if (messageOn[0] == true){
gChatDialog.Visible = true;
lblMessage1.Visible = true;
}
if (chatSay[1] != ""){
gChatDialog.TweenY(0.2, 10, eEaseLinearTween, eNoBlockTween); // some tweening action to move the boxes around, currently just place holder info
lblMessage2.Visible = true;
}
if (chatSay[2] != ""){
gChatDialog.TweenY(0.2, 10, eEaseLinearTween, eNoBlockTween);
lblMessage2.Visible = true;
}
if (chatSay[3] != ""){
gChatDialog.TweenY(0.2, 10, eEaseLinearTween, eNoBlockTween);
lblMessage3.Visible = true;
} if (chatSay[4] != ""){
gChatDialog.TweenY(0.2, 10, eEaseLinearTween, eNoBlockTween);
lblMessage4.Visible = true;
}
}
//separate script that would later serve as a dialogue editor
//triggered by pressing a button
function Dialog00(){
messageOn[0] = true;
chatSay[0] = "Hii";
messageOn[1] = true;
chatSay[1] = "Is this really you?!";
messageOn[2] = true;
chatSay[2] = "I know where you live";
messageOn[3] = true;
chatSay[3] = "Buahahah";
messageOn[4] = true;
chatSay[4] = "Say goodbye to your fish";
}
//setting up the function
void MySay(this Character*, String text ,String text2, String text3) {
lblSay2.Visible = false;
lblSay2.SetPosition(7, 123);
lblSay3.Visible = false;
lblSay3.SetPosition(7, 123);
lblSay1.Text = text;
lblSay2.Text = text2;
lblSay3.Text = text3;
gDialog.Visible = true;
Wait(40);
lblSay1.TweenPosition(0.2, 7, 100);
lblSay2.Visible = true;
Wait(40);
lblSay1.TweenPosition(0.2, 7, 77, eEaseLinearTween , eNoBlockTween);
lblSay2.TweenPosition(0.2, 7, 100);
lblSay3.Visible = true;
Wait(40);
lblSay2.TweenPosition(0.2, 7, 100);
Wait(40);
gDialog.Visible = false;
// using MySay();
function cClient1_Talk()
{
cClient1.MySay("Hi", "What's up", "Blah");
}
// Creates list of clients in the lstDatabase
function ClientList()
{
ClientInfo(); // this function includes bunch of Arrays with required info
int index = 0;
while (index < maxClients) { // maxClients = total number of clients in database
lstDatabase.AddItem(clientName[index]);
index ++;
}
lstDatabase.Sort(eOrderAscending, false); //Sorting function
}
// Replaces all GUI labels and buttons with client info
function ClientLabels()
{
lblName.Text = clientName[lstDatabase.SelectedIndex];
lblAddress.Text = clientAddress[lstDatabase.SelectedIndex];
lblName2.Text = clientName[lstDatabase.SelectedIndex];
lblAddress2.Text = clientAddress[lstDatabase.SelectedIndex];
bPhoto.NormalGraphic = clientPhoto[lstDatabase.SelectedIndex];
bPhoto2.NormalGraphic = clientPhoto[lstDatabase.SelectedIndex];
}
void Sort(this ListBox*, eOrder order, bool caseSensitive) {
int ic = this.ItemCount;
if (ic < 2) return;
int i, j, c;
String temp;
while (i < ic - 1) {
j = i + 1;
while (j < ic) {
c = this.Items[i].CompareTo(this.Items[j], caseSensitive);
if ((c < 0 && order == eOrderDescending) || (c > 0 && order == eOrderAscending)) {
temp = this.Items[i];
this.Items[i] = this.Items[j];
this.Items[j] = temp;
}
j++;
}
i++;
}
}
if (lDatabase.SelectedIndex == 0){
ClientID = 00;
lblName.Text = ClientName; // Here I just list all the labels that need to be changed
}
if (ClientID == 00){
ClientName = "John Smith;
ClientPhoto = 29;
}
function ID00(){
ClientName = John Smith
ClientPhoto = 29
Balance = 200
}
function ID01(){
ClientName = Jonny Smithy
ClientPhoto = 30
Balance = 2
}
//etc
if (lDatabase.SelectedIndex == 0){
function ID01();
}
minlab.TextColor=color;
gLoginScreen.Visible = false;
Parser.ParseText(txtUsername.Text);
Parser.ParseText(txtPassword.Text);
String badword = Parser.SaidUnknownWord();
if (badword != null){
Display("Wrong cridentials");
gLoginScreen.Visible = true;
}
Parser.ParseText(txtPassword.Text);
if (badword != null){
Display("Wrong cridentials");
gLoginScreen.Visible = true;
}
else if ((Parser.Said("codebank"))&&(Parser.Said("password"))){ // How to determine which Parser is which?
gBankOS.Visible = true;
}
gLoginScreen.Visible = false;
if ((txtUsername.Text == "codebank") && (txtPassword.Text == "password")){
gBankOS.Visible = true;
}
else {
Display("Wrong Cridentials");
gLoginScreen.Visible = true;
}
By continuing to use this site you agree to the use of cookies. Please visit this page to see exactly how we use these.
Page created in 0.054 seconds with 16 queries.