Non-threaded

Forums » Advanced Editor Forum » Read Thread

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

Using certain variables to get to certain pages?

10 years ago

Say you want to make it so that whenever your variables hit a certain exact number, on any pages, such as variables having to be the numbers 1,2,3,4,5,6,7,8,9,10, clicking on any links on that page will take it to another page made for those variables?

Such as 1,2,3,4,5,6,7,8,9,10 all have a separate page?

Using certain variables to get to certain pages?

10 years ago

For this, you would use a Global Script to check the Variable on every page and then send it to the Destination Page if the Value is correct.

For Example:

IF %VARIABLE > 0 AND %VARIABLE < 11 THEN $DEST := @P100

---

Or:

%VARIABLE = 1 THEN $DEST := @P100
%VARIABLE = 2 THEN $DEST := @P200
%VARIABLE = 3 THEN $DEST := @P300
%VARIABLE = 4 THEN $DEST := @P400
%VARIABLE = 5 THEN $DEST := @P500
%VARIABLE = 6 THEN $DEST := @P600
%VARIABLE = 7 THEN $DEST := @P700
%VARIABLE = 8 THEN $DEST := @P800
%VARIABLE = 9 THEN $DEST := @P900
%VARIABLE = 10 THEN $DEST := @P1000

Using certain variables to get to certain pages?

10 years ago

Thanks!

This was exactly what I needed.

 

Using certain variables to get to certain pages?

10 years ago

Now, do you post this in the global link script, or global page script? 

I got an error for both.

 Did not expect '='. Col=11

Using certain variables to get to certain pages?

10 years ago

For the second part

%VARIABLE = 1 THEN $DEST := @P100
%VARIABLE = 2 THEN $DEST := @P200
%VARIABLE = 3 THEN $DEST := @P300
%VARIABLE = 4 THEN $DEST := @P400
%VARIABLE = 5 THEN $DEST := @P500
%VARIABLE = 6 THEN $DEST := @P600
%VARIABLE = 7 THEN $DEST := @P700
%VARIABLE = 8 THEN $DEST := @P800
%VARIABLE = 9 THEN $DEST := @P900
%VARIABLE = 10 THEN $DEST := @P1000

I got an error, for both the global link, and global page. 

Using certain variables to get to certain pages?

10 years ago

Seriously, read the articles already. The reason it doesnt work is really obvious. You need to actually understand the system to use it. 

Using certain variables to get to certain pages?

10 years ago

I figured it out. I didn't type the IF statement for the second one. 

Using certain variables to get to certain pages?

10 years ago

Good. Sorry if im sounding harsh, its just you'll save everyone a lot if time if you learn how it works rather than asking for every little thing. 

Using certain variables to get to certain pages?

10 years ago

Okay. Is it possible for the variable only to bring you to the page one time, as oppose to being stuck on the same page as long as the variable is the certain number? 

Using certain variables to get to certain pages?

10 years ago

Have the Script add a Value to another Variable to track how many times you have been to a certain page and then compare to decide if you should go to it again or another page instead.

Using certain variables to get to certain pages?

10 years ago

I tried to script it so that when you gain 30 experience points, it brings you to the page LEVEL UP, but once I'm on the page LEVEL UP, every time I click the link to get out of the page LEVEL UP it brings me back to the same page. 

I thought of change the variable of EXPERIENCE again to make it so I can click the link to get to a different page, but what I'm trying to do is something like this. 

IF %EXPERIENCE > OR EQUAL TO 30 AND %EXPERIENCE < 70 THEN $DEST := @P100

IF %EXPERIENCE > OR EQUAL TO 70 AND %EXPERIENCE <120  THEN $DEST := @P100

IF %EXPERIENCE > OR EQUAL TO 120 AND %EXPERIENCE < 180 THEN $DEST := @P100

But the thing is, once it's on the page, it's stuck on the page, unless I change the variable of experience again once, on that page, and I don't think it's work if it's like that, espiecally if I'm using bigger than or equal to "Variable" and less than "Variable" to determine the page number. 

 

Using certain variables to get to certain pages?

10 years ago

"when you gain 30 experience points, it brings you to the page LEVEL UP"

Explain further what you actually want, because what you actually have scripted has little resemblance to what you're saying.

Using certain variables to get to certain pages?

10 years ago

What I meant was that if say, is that when the variable %%experience%% is more than or equal to 30, and less than 60, I want it to bring me to a page call "LEVEL UP" BUT 

Once I'm on the page call "LEVEL UP" any links I click will just get me back to the page "LEVEL UP" because the variable %%experience%% is now somewhere between 30 and 60 (I still don't know how to OR EQUALS to btw) , and it will not let me do so unless the variable "experience" is change to less than 30 or more than 60. 

 

Using certain variables to get to certain pages?

10 years ago

Okay, so if that's the case they what are the following lines for:

IF %EXPERIENCE > OR EQUAL TO 70 AND %EXPERIENCE <120  THEN $DEST := @P100

IF %EXPERIENCE > OR EQUAL TO 120 AND %EXPERIENCE < 180 THEN $DEST := @P100

You can do <=, and >= to do OR EQUALS.

Using certain variables to get to certain pages?

10 years ago

Those two lines are for when after the variable %%experience%% is more than or equal to 30, and less than 70, the variable %%level%% will be equal to 2.

when after the variable %%experience%% is more than or equal to 70, and less than 120, the variable %%level%% will be equal to 3.

when after the variable %%experience%% is more than or equal to 120, and less than 180, the variable %%level%% will be equal to 4.

so and on.

Using certain variables to get to certain pages?

10 years ago

Actually I think this might work.

IF %EXPERIENCE >=  30 AND  %EXPERIENCE < 70 THEN %LEVEL := 1

IF %EXPERIENCE >=  70 AND %EXPERIENCE <120  THEN %LEVEL := 2

IF %EXPERIENCE >= 120 AND %EXPERIENCE < 180 THEN %LEVEL:= 3

What do you think? 

Using certain variables to get to certain pages?

10 years ago

Okay I tried.

IF %EXPERIENCE >= 30 AND %EXPERIENCE < 70  THEN %LEVEL := %LEVEL+ 1
 
IF %EXPERIENCE >= 70 AND %EXPERIENCE < 120 THEN %LEVEL:= %LEVEL+ 1
 
IF %EXPERIENCE >=  120 AND  %EXPERIENCE < 180 THEN %LEVEL := %LEVEL+ 1
 
IF %EXPERIENCE >=  180 AND %EXPERIENCE <250  THEN %LEVEL := %LEVEL+ 1
 
IF %EXPERIENCE >= 250 AND %EXPERIENCE < 330 THEN %LEVEL:= %LEVEL+ 1
 
IF %EXPERIENCE >=  330 AND  %EXPERIENCE < 420 THEN %LEVEL := %LEVEL+ 1
 
IF %EXPERIENCE >=  420 AND %EXPERIENCE <520  THEN %LEVEL := %LEVEL+ 1
 
IF %EXPERIENCE >= 520 AND %EXPERIENCE < 630 THEN %LEVEL:= %LEVEL+ 1
 
IF %EXPERIENCE >=  630 AND  %EXPERIENCE < 750 THEN %LEVEL := %LEVEL+ 1
 
The part where it goes wrong is AND %EXPERIENCE < 70.
Without this part included, it works perfectly fine.
But when I included it, the variable "Level" doesn't go up. It stays at the same variable.
 
Is there anyone that can see what I'm missing here? 
 

Using certain variables to get to certain pages?

10 years ago

So, a few things:

A) When I ask "What is this for?", I want to know WHY you're doing that, not what it literally does (cause I can see what it does just fine).

B)Where are you doing this script?

C)This probably won't work, because you have nothing to break out of this IF statement (as soon as it is true once, it's always true)

From what I gather, you want the person to start at level 0, with 0 experience. When they have 30 XP, they level up. Then when they have 70 XP, they level up again. Basically, it takes 10 more xp than it did for the previous level, each time to level up, right?

Using certain variables to get to certain pages?

10 years ago

Yes. How did I do that? 

Using certain variables to get to certain pages?

10 years ago

How did you do what?

Using certain variables to get to certain pages?

10 years ago

But the less than %%variable%% part doesn't work. 

A) This is for leveling scripting.

B) I'm doing this script on the global link script

C) I founded out that this one works, IF %EXPERIENCE >= 30  THEN %LEVEL := 2

But this one doesn't,  IF %EXPERIENCE >= 30 AND %EXPERIENCE < 70  THEN %LEVEL := 2

 

Using certain variables to get to certain pages?

10 years ago

A) That's fantastic. Now explain why did you do it that way.

C) Dunno, maybe adding the = sign screws it up.

Either way, doing all those checks for every single level is a waste. There's a simpler way of doing it since you level up following a clear cut formula.

%NEXTLEVEL := 10 * %LEVEL + 30

IF %EXPERIENCE >= %NEXTLEVEL THEN
BEGIN
%LEVEL := %LEVEL + 1
%EXPERIENCE := %EXPERIENCE - %NEXTLEVEL
END

Whenever the player has enough experience to level up, they gain a level and their experience goes back down. Alternatively, if you always want to keep their experience, you can do this:

IF %EXPERIENCE >= %NEXTLEVEL THEN
BEGIN
%LEVEL := %LEVEL + 1
%NEXTLEVEL := 10 * %LEVEL + 30 + %NEXTLEVEL
END

And just make sure you start %NEXTLEVEL at 30.

This takes care of the leveling up at least.

Using certain variables to get to certain pages?

10 years ago

Thanks.

They both work perfectly fine.

 

Using certain variables to get to certain pages?

10 years ago

(You only need to use one of them, since they do the same thing)

Using certain variables to get to certain pages?

10 years ago

Okay, now that it's working, I can't get this to start working.

IF %LEVEL := %LEVEL + 1 THEN %POINTS := %POINTS + 30

I'm trying to make it so that whenever you level, you get 30 stat points to spend, but there's an error somewhere that I can't seem to figure out. 

Using certain variables to get to certain pages?

10 years ago

 

Well you're checking if a level will ever be equal to one higher than itself, which is logically impossible lol.

Using certain variables to get to certain pages?

10 years ago

Oh, it works when I put it in like this. 

%NEXTLEVEL := 10 * %LEVEL + 30
 
IF %EXPERIENCE >= %NEXTLEVEL THEN
BEGIN
%LEVEL := %LEVEL + 1
%POINTS := %POINTS + 30
%EXPERIENCE := %EXPERIENCE - %NEXTLEVEL
END

Using certain variables to get to certain pages?

10 years ago

Well yeah. You're not doing an impossible check there haha. Makes sense for you to do it this way, so gj.

Using certain variables to get to certain pages?

10 years ago

Thanks.

Now I'm trying to make this one work, but don't know the symbols for it. 

IF %HEALTH (increase by so and so) THEN %FULLHEALTH (will also increase by so and so)

Is that possible to do? If so, how?