I have a room that I want to scroll upwards, while also running a TypeLine function. Both work perfectly independantly but they don't seem to like each other.
I start them at roughly the same time, and they run fine, but I can't start a new TypeLineInvis until the scrolling stops. It will just wait until the scrolling is done and then run the next line of text.
Is this something to do with them both being in repeatedly_execute_always?
This is in the room script:
Code: ags
and this is in the grobal script:
Code: ags
In repeatedly_execute_always:
Code: ags
Code: ags
AND this is in repeatedly_execute:
Code: ags
It's a bit all over the place, but it needs to be for the function to work with all the lines I use with it. Trust me.
Basically, the final number of TypeLineInvis is the number that determines what the next line to run after it has been removed will be.
I start them at roughly the same time, and they run fine, but I can't start a new TypeLineInvis until the scrolling stops. It will just wait until the scrolling is done and then run the next line of text.
Is this something to do with them both being in repeatedly_execute_always?
This is in the room script:
function repeatedly_execute_always() {
vpx=GetViewportX(); // Get current viewport coordinates
vpy=GetViewportY();
oPurplestars.SetPosition(0, oy1-((vpy*5)/15)); //furthest parallax object
oWhitestars.SetPosition(0, oy2-((vpy*5)/10));//closest parallax object moves
}
#sectionstart room_c // DO NOT EDIT OR REMOVE THIS LINE
function room_c() {
// script for Room: Player enters room (after fadein)
if (GetGlobalInt(28)==1) {
TypeLineInvis("Line One,", 5, 200, 20, 160, 275, 11);
yposit=GetViewportY();
xposit=0;
while (yposit > 0) {
SetViewport(xposit, yposit);
Wait(2);
yposit--;
}
}
and this is in the grobal script:
function TypeLineInvis (const string say, int delay, int wait, int xpos, int vpos, int width, int queue) {
if (IsGamePaused()==0) {
StopMoving(EGO);
SetTextWindowGUI(31);
StrCopy(displayedline,"");
StrCopy (line, say);
typecount=0;
textid = CreateTextOverlay(xpos, 100, 400, 1, 1, displayedline);
length=StrLen(line);
SetTimer(6, delay);
delaya=delay;
vposa=vpos;
xposa=xpos;
waita=wait;
widtha=width;
cue=queue;
}
}
In repeatedly_execute_always:
if (IsTimerExpired(6)) {
if (typecount<length) {
StrFormat(displayedline, "%s%c", displayedline, StrGetCharAt(line,typecount));
SetTextOverlay(textid,xposa,vposa,widtha,1,1,displayedline);
if (StrGetCharAt(line,typecount)!=' ') PlaySound(1);
typecount++;
if (typecount==length) {
if (waita>0) SetTimer(7, waita);
else RemoveOverlay(textid);
}
else {
SetTimer(6, delaya);
}
}
}
if (cuetli==1) {
else if (cue==11) TypeLineInvis("Line Two", 5, 200, 20, 160, 275, 12);
else if (cue==12) TypeLineInvis("Line Three,", 5, 200, 20, 160, 275, 13);
//// ... etc
cuetli--;
}
AND this is in repeatedly_execute:
if (IsTimerExpired(5)) {
if (cue==11) cuetli=1;
}
It's a bit all over the place, but it needs to be for the function to work with all the lines I use with it. Trust me.
Basically, the final number of TypeLineInvis is the number that determines what the next line to run after it has been removed will be.