Non-threaded

Forums » Newbie Central » Read Thread

Introduce yourself and get to know the community.

Scripting

18 years ago
In my next few games i will use advanced battles like in RPGs,  but I need to know how to use scripting.

Scripting

18 years ago
three articles.

Scripting

18 years ago
There are three articles written on that. They are:

The Basics of Scripting byalexp
Intermediate Scripting bysolostrike
Scripting: Items byOctober

They should be read in that order. If you need any extra help about that (trust me, there is more than what is in those three articles) then contact either alexp, solostrike, myself, tsmpaul, Madglee or anybody else who knows scripting. I s'pose I should include JJJ there now, he's quite a natural.

Scripting

18 years ago
thnx!

Scripting

18 years ago
No way dont include me!!! I may be a natural but Im still a rookie.  Give me time to develop :P

Scripting

18 years ago
Alright, I have a question I couldn't find in those articles:

I have a variable in Quest to Glory (I am using Script for it). It is MANA and is used for spells and crap. Anyway, I want to have it so that whenever you take an action, it regenerates by 1 point. For example...

Say that you're on a...mountain. You've just killed a creature with a "Plume of Fire" spell; it costs 15 MANA. Now you're waiting around, and you decide to look at some mountain flowers. After going to that link (Look at Mountain Flowers), your MANA increases by 1.

How would I do this? I know I have to allow the script to say (in English): When MANA is below 50 (the max), +1 MANA per action. How would I script this?

I think the beginning would be this:

%MANA := > 50 THEN
[+1 MANA per action]

Is the beginning right?

Scripting

18 years ago
I also have another question with scripting for QtG (Quest to Glory):

I have a variable STORAGE (max: 10, min: 0, start: 0) that shows how much crap you have in your inventory. Anyway, at the beginning of the game, there is a farm growing corn. You can buy corn there, and so I wanted corn to be an item, but wanted it in variable form. However, there are other items, like potions, with a more potent healing power. But I want a player to be able to use both (not at the same time, but in the same inventory. So here's my question: Can I have a variable show a certain amount of a variable that is being affected by another variable? In Enlgish, I'm asking "How can I make CORN and POTIONS show a certain amount when they're being controlled by STORAGE, the amount of space in one's inventory?" Here's an example:

Say you have 6 CORN and 4 POTIONS. CORN and POTIONS are separate variables, but are controlled by STORAGE. How do I show CORN and POTIONS at their current amounts when the STORAGE variable is affecting them BUT CAN CHANGE?

Scripting

18 years ago
For the first one, put it in Global Link Script.

Scripting

18 years ago
For the first one, like JJJ said, put this script in Global Link Script.

IF %MANA < 50 THEN
BEGIN
   %MANA := %MANA + 1
END

In explanation:
If the variable 'Mana' is less than fifty, then Mana is set to what it previously was plus one.

Note that you said in the first line of your guessing script 'IF %MANA := < 50". The term := means "is set to". If you want to use equal or less than etc. you don't need to include the :=.

For your next script you could have in Global Link Script:

%STORAGE := %CORN + %POTIONS

You can also use the $ITEMUSE system variable (I wrote an article on that, feel free to read it for further explanation) to show how much of a variable you have left.

Hope that helped.

Scripting

18 years ago
Ah, yes, of course! Thanks so much, dudes. I'm pretty sure this was explained in the articles, so that says something about my reading ability LOL. Anyway, does the Global Link affect everything? Does that script say that "If 50 MANA is attained, stop until MANA is less than 1?"

Scripting

18 years ago
How can I have multiple Global Links?

Scripting

18 years ago
Well, actually October, you didn't answer my question completely. (sorry for the triple posts)

My full question was "CORN and POTIONS rely on STORAGE for their maximum, but you can have up to 10 of any item in Storage; the problem is, the CORN and POTIONS variables will change too, and having them at 10 makes STORAGE obsolete, OR DOES IT? Does having STORAGE = CORN + POTIONS make it so that the maximum of STORAGE affects the maximum (in any circumstance) of CORN and POTIONS, making their maximums be so as to not conflict with STORAGE and cause it to be obsolete?

What I'm asking is, Will CORN and POTIONS be affected by STORAGE depending on how much suff is in STORAGE?

For example: If you have 6 CORN and 4 POTIONS, then that will make STORAGE equal 10, right? But it also makes CORN and POTIONS change their maximum to the respective (and in this case, current) amount?

Scripting

18 years ago

To get global links make sure scripting is set to advanced.. Then click on scripting.

Scripting

18 years ago
Yeah, well, it only allows one Global Link as far as I can tell. How do I add more?

Scripting

18 years ago
BEGIN and END functions seperate tehm i believe.

Scripting

18 years ago
Oh yeah, that could do it. Thanks, JJJ. You probably pointed out something I missed. I bet I'm looking like an idiot LOL.

Scripting

18 years ago
I was worse when I started :D

Scripting

18 years ago
I forgot to ask, are you going to have more items than corn and potions?

If not - %CORN and %POTIONS can change around how many there is, sure. It just means that %STORAGE is always equal to %CORN and %POTIONS put together. If potions is ten and corn is zero, then that still equals ten.

Scripting

18 years ago
A Global Link effects every single link in the game. For example if you have %GOLD := %GOLD + 1 on a global link, in order to counteract that with a certain link would be to have on the particular link %GOLD := %GOLD. I'm not sure if singular links have a higher power than global, but that's just my guess.

I don't really get your question. I'll try reading it again and replying.

Scripting

18 years ago
And global page effects every page.

Scripting

18 years ago
What about with Damage? How would I write a Global Link for damage?
Here's what I have so far:

%DAMAGE := (%POWER + %EDEFENCE) [Enemy Defence]
IF %DAMAGE < (%POWER + %EDEFENCE)
THEN %DAMAGE = 0
END

It says that this isn't valid. Why not? What must I change?

Scripting

18 years ago

I'l leave this one for october.  Solo or madglee or tsmpaul or alex will be able to do it too.

Scripting

18 years ago
Okay, I'll PM those guys. See if they know anything.

Scripting

18 years ago

First, when typing IF and THEN, I believe you need to have the word THEN on the same line as the word IF

So, you'd have

IF %DAMAGE < (%POWER + %EDEFENCE) THEN
%DAMAGE=0
END

However, looking at your script, it doesn't make sense - your first line sets damage to equal POWER + EDEFENCE, so it is impossible for DAMAGE on the second line to be less than POWER + DEFENCE, because you just told it to make it equal to POWER + DEFENCE on the line above!

Scripting

18 years ago

IF %DAMAGE < (%POWER + %EDEFENCE)
THEN %DAMAGE = 0
END

Should be

IF %DAMAGE < (%POWER + %EDEFENCE) THEN
BEGIN
  %DAMAGE := 0
END

Remember, "=" means "is equal to" and ":=" means "assign to".  Also, an "END" must have a "BEGIN".

Scripting

18 years ago

"I'm not sure if singular links have a higher power than global, but that's just my guess."

Global Link Scripts first, then Link Scripts. They both run.

Scripting

18 years ago
But what about Damage on its own? Would I just make a entirely new link? Like, Damage equals Power + EDefence?

Scripting

18 years ago

Nuby's got the big guns helping him.

Scripting

18 years ago
It's always nice to know you're safe as your big guns take out the pathetic invaders. Oh wait, that's my Stronghold 2 side of my brain right there. I play too many RTS's.

Scripting

18 years ago

lol

Scripting

18 years ago
Anyway, thanks everyone with the help on Scripting. And remember, this isn't just for me. It's for everyone.

Scripting

18 years ago
Amen