Non-threaded

Forums » Advanced Editor Forum » Read Thread

Get help from the experts on variables, scripts, items, and other scary things.

This doesn't work for some reason

11 years ago

IF %HOUR > 11 AND %MIN > 0 THEN
BEGIN
%TWELVE := %TWELVE + 1
END

This doesn't work for some reason

11 years ago

Use something like this to do the same thing -

IF %HOUR > 11 THEN
BEGIN
IF %MIN > 0 THEN
%TWELVE := %TWELVE + 1
END

This doesn't work for some reason

11 years ago

Here are all the codes I'm using in the global link script. It's still not working for me for some reason.

 

%MIN := %MIN + 1D10
 
IF %MIN >= 60 THEN
BEGIN
%HOUR := %HOUR + 1 
%MIN := 0
END
 
IF %HOUR > 12 THEN
BEGIN
%HOUR :=1
END 
 
IF %TWELVE = 2 THEN
BEGIN
%DAY := %DAY + 1
%TWELVE := 0
$DEST := @P115
END 
 
IF %HOUR > 11 THEN
BEGIN
IF %MIN > 59 THEN
%TWELVE := %TWELVE + 1
END

This doesn't work for some reason

11 years ago

Are you sure it doesn't work?

This doesn't work for some reason

11 years ago

Yes, for some reason. 

This doesn't work for some reason

11 years ago

It's another logic error.

Your first part checks to see if %MIN is >= 60, and changes it to 0 if it is.

By the time it gets to here:

IF %HOUR > 11 THEN
BEGIN
IF %MIN > 59 THEN
%TWELVE := %TWELVE + 1
END
 
It's impossible for %MIN to be >59, because if it was, you would have already changed it to 0.

This doesn't work for some reason

11 years ago

I'm trying to make time work in the stories.

Every time you click a link, time pass by randomly, and every time you wake up, you wake up at random times.

The time is in 12 hour mode, meaning it has A.M and P.M. 

The thing is, I got it to work so far without the word 'random'.

I could get time to pass and when it's A.M it'll say A.M and when it's P.M it'll say P.M, but I still can't get time to pass by randomly, or for you to wake up randomly, because %TWELVE is use to determine if it's A.M or P.M. When it's 1 it's P.M, and when it's 0 it's A.M.

I'm trying to make it so that once the variable %HOUR passes 11, and variable %MIN passes over 59, variable %TWELVE increase by one, but it won't ever work. 

This doesn't work for some reason

11 years ago

Did...

Did you even read what I just said?

This doesn't work for some reason

11 years ago

Yes. I fixed it. 

This doesn't work for some reason

11 years ago

Actually, no, I thought I fixed it. 

It still won't work.

I read and understood what you wrote down, but I still don't have a solution to fix it. 

This doesn't work for some reason

11 years ago

You have some redundancy which is messing with things. Try this:

%MIN := %MIN + 1D10
 
IF %MIN >= 60 THEN
BEGIN
%HOUR := %HOUR + 1 
%MIN := 0
END
 
IF %HOUR > 12 THEN
BEGIN
%HOUR :=1
%TWELVE := %TWELVE + 1
END 
 
IF %TWELVE = 2 THEN
BEGIN
%DAY := %DAY + 1
%TWELVE := 0
$DEST := @P115
END 

This doesn't work for some reason

11 years ago

That won't work either.

What happens when it's 12:15 P.M?

The A.M then won't change to an P.M because %TWELVE is still 0 at that time.

Only when it's 1:00 P.M will %TWELVE turn into 1. 

So that timeframe from 12-1 will still glitch and if players check the watch on that time, they will see the glitch. 

I managed to make it not glitch ONLY if I'm NOT using random numbers for the minutes, but that kind of defeats the point because I want to use random numbers. I'm still not COMPLETELY sure I could do the time reset using that, but I think I can do the time reset using this one. 

This doesn't work for some reason

11 years ago

Then do %HOUR >= 12, lol.

The variables being random have absolutely nothing to do with it not succeeding.

Ohh wait, I think I get your issue now. Just think about it logically for a bit.

This doesn't work for some reason

11 years ago

I can't do 

IF %HOUR >= 12 THEN

because that would change the hour to 1 o' clock when it's only 12 o' clock, when the variable %HOUR is = to 12. That doesn't solve anything anyway, and I can't think of anything else, other then taking away the random variables. 

This doesn't work for some reason

11 years ago

Again, the random variable has nothing to do with it not working. Just because you did it another way not using a random variable, doesn't mean the random variable was the issue.

This doesn't work for some reason

11 years ago

I would suggest taking all Variables involved with this and selecting them to Show On All Pages - then step through things and observe the Variable Changes. You may be surprised at their Values not being what you expect (which would explain Scripts appearing not to work when they really do).

One thing that you may run into is Page vs. Link Script.

When changing a Variable with a Link Script the Change happens before the New Page is Loaded and Shows immediately.

When changing a Variable with a Page Script the Change happens after the New Page is Loaded and Shows after you leave the new Page.

This doesn't work for some reason

11 years ago

It's just a logic error on his part. The AM/PM are switching places AFTER 12, when they need to do so before 12.

%MIN := %MIN + 1D10
 
IF %MIN >= 60 THEN
BEGIN
%HOUR := %HOUR + 1 
%MIN := 0
END
 
IF %HOUR > 12 THEN
BEGIN
%HOUR :=1
END 
 
IF %HOUR > 11 THEN
BEGIN
%TWELVE := %TWELVE + 1
END
 
IF %TWELVE = 2 THEN
BEGIN
%DAY := %DAY + 1
%TWELVE := 0
$DEST := @P115
END
 
This is all he needs to do. Add a separate check so that way it changes AM/PM when the time is greater than 11, but still resets the hours when it's greater than 12. And if he really wants it to be random, he should change %MINUTE := 0, to %MINUTE := %MINUTE - 60, so that it keeps some of the random value it had from before.

This doesn't work for some reason

11 years ago

I'm going to try this.

I hope this works.

Thanks. 

(This post is for robot)

This doesn't work for some reason

11 years ago

That won't work either.

If %HOUR is bigger than 11, %TWELVE will increase itself by 1.

Which means, that through the time when it's 12, every time a link is click, %TWELVE will increase itself by 1.

Which means, A.M and P.M will reset several times over when it's 12. 

So, it won't work. 

This doesn't work for some reason

11 years ago

Hmm, good point.

Put the check inside of where it actually changes the hour then.

%MIN := %MIN + 1D10
 
IF %MIN >= 60 THEN
BEGIN
%HOUR := %HOUR + 1 
%MIN := 0
IF %HOUR = 12 THEN
BEGIN
%TWELVE := %TWELVE + 1
END
END
 
Like that. You really should be thinking about this yourself though.

This doesn't work for some reason

11 years ago

I'll try it. Thanks. 

I never knew you could put an if then statement inside another if then statement so it never occur to me.

Hope this works though. 

This doesn't work for some reason

11 years ago

Also, the way this works, it seems as though if then statements are process AFTER the set to statement, right? 

This doesn't work for some reason

11 years ago

But the way this works, it seems as though, the set to %MIN statement works first.

Then the IF THEN %MIN statement

Then the set to %HOUR statement

Then the set to %MIN statement

Then the IF THEN %HOUR statement

Then the set to %TWELVE statement.

It's all very confusing, lol. 

This doesn't work for some reason

11 years ago

Yep, thats how it works. 

This doesn't work for some reason

11 years ago

I used this yesterday. It worked. I think. I'm not 100 percent sure though. 

 
 
%MIN := %MIN + 1D10
 
IF %MIN >= 60 THEN
BEGIN
%HOUR := %HOUR + 1 
%TWENTYFOUR := %TWENTYFOUR + 1
%MIN := 1D30
END
 
IF %TWENTYFOUR = 24 THEN
BEGIN
%DAY := %DAY + 1
%TWENTYFOUR := 0
END
 
IF %HOUR > 12 THEN
BEGIN
%HOUR :=1
END 

This doesn't work for some reason

11 years ago

I have tried that. 

I know why it's not working. 

I just don't have a solution to fix it. 

(This post is for berkerka)

This doesn't work for some reason

11 years ago

So, I was forced to use this. 

 

 

%MIN := %MIN + 5

%INV := %INV + 5

 

IF %INV = 300 THEN

BEGIN

%TWELVE := 1

END

 

IF %INV = 1020 THEN

BEGIN

%TWELVE := 2

%INV := 0

END

 

IF %MIN = 60 THEN

BEGIN

%HOUR := %HOUR + 1

%MIN := 0

END

 

IF %HOUR > 12 THEN

BEGIN

%HOUR :=1

END

 

IF %TWELVE = 2 THEN

BEGIN

%DAY := %DAY + 1

%TWELVE := 0

$DEST := @P115

END