WatchNon-threaded

Forums » Advanced Editor Forum » Read Message

Talk about it. Ask for help on it. Compliment it.

How come this isn't working?

11 days ago

Okay, so I have a clock on one of my games, and I've scripted it so that once it hits 12, it goes back to 1. The only problem is, I want the clock to say whether it's 1 AM or 1 PM. I made this script which looks fine to me:

IF %TIME = 12 AND %AMPM = 1 THEN
%AMPM := 2

IF %TIME = 12 AND %AMPM = 2 THEN
%AMPM := 1

 

 ... But it doesn't work. >.<

Anyone have any idea what's wrong with it?

How come this isn't working?

11 days ago
It's probably running both of them one after another without the actual change to TIME that would cancel that out getting to kick in.

Try moving the order of the scripts around maybe? Using BEGIN and END to bookmark multiple IF statements may be more reliable than AND as well.

I'm at work right now so I can't really test anything.

How come this isn't working?

11 days ago

Thanks Miz. ^_^

How come this isn't working?

11 days ago

Edit: ... Where do the BEGIN and END go? :'(

How come this isn't working?

11 days ago
IF blah blah THEN
BEGIN
%BLAH := WHATEVER
%BLAHBLAH := ETC
END


It's just so there's no confusion in the order variables are checked and messed with. I think half the time when I use it it's not actually necessary, but it keeps things more organized visually too.

How come this isn't working?

11 days ago

Thank you! ^_^

How come this isn't working?

11 days ago

... I've just realized what you mean though, and I don't think I can code this using multiple IF statements instead of AND. >.<

How come this isn't working?

11 days ago
TBH It's probably easier to make -1 mean PM, 1 mean AM, then your logic just becomes the following:

IF %TIME = 12 THEN
%AMPM := 0 - %AMPM

This will flip between 1 and -1 whenever its run.

How come this isn't working?

11 days ago

Genius! ^_^

How come this isn't working?

11 days ago

It works!!! ^_^

How come this isn't working?

11 days ago

It seems the second statement undoes the action of the first. I think you want

IF %TIME=12 THEN BEGIN  
 IF %AMPM=1 THEN %AMPM:=2
 ELSE IF %AMPM=2 THEN %AMPM:=1
END

 

If AMPM can only be one or two it becomes a bit easier. In this case 

IF %TIME=12 THEN BEGIN
  IF %AMPM=1 THEN %AMPM:=2
  ELSE %AMPM:=1
END

 

How come this isn't working?

11 days ago

Oops, sorry it seems I am late to the party!

How come this isn't working?

11 days ago
Thank you! This will probably come in useful later ^_^

How come this isn't working?

9 days ago

I'm stupid again! >.<

Okay, so this time I've scripted a little code that's supposed to show up if I don't have an item in my inventory and disappear once I pick up the item. The code is:

%%ITEMSTATE1%=%0%You do not have this item in your inventory%%

... But the text shows up whether I have the item in my inventory or not. Anyone know what's wrong?

How come this isn't working?

9 days ago
Try ITEMSTATE01.

That's what you need for using it in normal scripts anyway, but ITEMSTATE01 is a system variable (it's got the $) so I'm not actually sure if it works the and as a regular one for on page scripting.

How come this isn't working?

9 days ago

Thanks, but doesn't work... Dag nab it, am I going to have to create a variable for all of the items too? Curse you, items!

How come this isn't working?

9 days ago
If there's a lot then you should maybe wait for someone who has a better idea of what they're doing to confirm this first.

But really this is what you deserve for using items.

How come this isn't working?

9 days ago
It is. Items are evil. :(

How come this isn't working?

9 days ago
You... you have an on page script, to tell a player if they have an item...

An item which, would appear in the inventory... On that same page...

Why would you do such a thing?

How come this isn't working?

9 days ago
Well, that's not what it actually says. It actually says "You see a thingamajiggy on the floor. It is a very pretty thingamajiggy. You want that thingamajiggy. You should really pick up the thingamajiggy." ... Or something like that.

How come this isn't working?

9 days ago
Just slap that sonafabitch directly into their inventory and don't give them a choice in the matter.

How come this isn't working?

9 days ago
Ah, that makes more sense.

Anyway, given its a system variable that's probably the reason why it won't work. If it's something you're adding to the end of the page you could just do a page script:

IF $ITEMSTATE01 = 0 THEN $PAGETEXT := $PAGETEXT + " PICKUP THE DAMN ITEM"

How come this isn't working?

9 days ago
Thank you! ^_^

How come this isn't working?

8 days ago

I should really use less coding in my games.

Anyway, new coding problem. "=" is working just fine with coding. For example:

"IF %WORKING = 1 THEN

%HURRAY := 1"

This works. But, ">=" really doesn't want to work at all. So:

"IF %WORKING >= 1 THEN

%FUCKIT := 1"

Doesn't work at all. Anyone know what's wrong with it? Because if I have to go through all the different variations of numbers, this is going to take forever. >.<

How come this isn't working?

8 days ago
Just tested, works for me. Could you send a longer bit of script where the error occurs?

How come this isn't working?

8 days ago

The script I'm using is:

IF %TIME >= 3 AND %PLANT = 1 THEN

%PLANT := 2

It's part of a script on a particular page. If I use:

IF %TIME = 3 AND %PLANT = 1 THEN

%PLANT := 2

Then it works... But since I need it to work for numbers above 3 as well, this is pretty annoying, since if I can't figure out a way to make the whole ">=" part work, then I'm going to have to code it all individually for numbers between 3 and 24. >.<

How come this isn't working?

8 days ago
What happens if you do this:

IF %TIME >= 3 THEN BEGIN
$PAGETEXT:=$PAGETEXT+" - TEST 1 -"
IF %PLANT = 1 THEN BEGIN
%PLANT:=2
$PAGETEXT:=$PAGETEXT+" - TEST 2 -"
END
END

How come this isn't working?

8 days ago

Yey! It works! Thank you!

How come this isn't working?

8 days ago
OK I have managed to reproduce the problem. This looks like a bug with the engine. But this workaround should fix it for you.

IF %TIME >= 3 THEN BEGIN
IF %PLANT = 1 THEN %PLANT:=2
END

How come this isn't working?

8 days ago
This one is a bit more concise. Do you want to put this problem in the bug forum?

How come this isn't working?

8 days ago
I'm not 100% sure what the bug is.

How come this isn't working?

8 days ago
'>=' does not work with 'AND'

How come this isn't working?

8 days ago
OH! That's what the problem was! >.<

How come this isn't working?

8 days ago
>= is not necessary. Just use the number above or below the =.

Exapmle: 4 or higher is >3; 4 or lower is <5.

How come this isn't working?

8 days ago
Just tried, that does not seem to work together with 'and' either.