 |
Castle Paradox
|
View previous topic :: View next topic |
Author |
Message |
Mortem Monkey

Joined: 19 Sep 2003 Posts: 19 Location: Deep in to the recesses of your mind.
|
Posted: Mon Oct 27, 2003 3:37 pm Post subject: God I'm needy |
|
|
I was wondering if somebody (preferly a good to great plotscripter) could take some time to explain how to use few plotscripting commands that have been confusing me for a good long while. If somebody volunters i'll list my problems. _________________ If you don't believe that God has a sense of humor then you explain the french! |
|
Back to top |
|
 |
Minnek Conjurer

Joined: 03 Jun 2003 Posts: 430 Location: Somewhere
|
Posted: Mon Oct 27, 2003 3:39 pm Post subject: |
|
|
I'm in, toss 'em here  _________________ * SDHawk has joined #Minnek
SDHawk> AAAAAAAAAAAAAUUUUUUUUUGH
* SDHawk has left #Minnek (Leaving) |
|
Back to top |
|
 |
Cube Dimensional Traveller

Joined: 02 Feb 2003 Posts: 294
|
Posted: Mon Oct 27, 2003 4:00 pm Post subject: |
|
|
People keep solving everyone's problems in this forum . I never get to do my job, heheh. Oh well.
* Cube relaxes *
But yeah, post up the commands and we'll explain them. |
|
Back to top |
|
 |
Mortem Monkey

Joined: 19 Sep 2003 Posts: 19 Location: Deep in to the recesses of your mind.
|
Posted: Mon Oct 27, 2003 5:19 pm Post subject: Here they are |
|
|
Find Hero. I know how to put it in a script I just don't know what it is for. Or how to use it.
Autonumber. I just don't get that one.
Days of play. What do you use that for?
Define constant. How do you use constants?
Divide. You'll always know what it will come out too so whats the point?
Subtract. The same as all my math problems.
Equal. Same as above.
Add. Ditto.
Mod. Same.
Multiply. Again same.
Or. What do you use it for?
Random. How is it helpful?
Rank in Caterpillar. Same as Find Hero.
Variable. I don't understand what you can use these for.
While. What can you use these for?
If. These confuse me to no end. I need a really in depth intruction in this one.
xor. What is it for? _________________ If you don't believe that God has a sense of humor then you explain the french! |
|
Back to top |
|
 |
Minnek Conjurer

Joined: 03 Jun 2003 Posts: 430 Location: Somewhere
|
Posted: Mon Oct 27, 2003 5:59 pm Post subject: |
|
|
Quote: | Find Hero. I know how to put it in a script I just don't know what it is for. Or how to use it.
Autonumber. I just don't get that one.
Days of play. What do you use that for?
Define constant. How do you use constants?
Divide. You'll always know what it will come out too so whats the point?
Subtract. The same as all my math problems.
Equal. Same as above.
Add. Ditto.
Mod. Same.
Multiply. Again same.
Or. What do you use it for?
Random. How is it helpful?
Rank in Caterpillar. Same as Find Hero.
Variable. I don't understand what you can use these for.
While. What can you use these for?
If. These confuse me to no end. I need a really in depth intruction in this one.
xor. What is it for? |
Okay, I'll go through these as best I can, except for xor, which I don't remember what it does.
Find Hero: This is used when you're modifying someone's stats or picture or something that's in your party. This locates them, and returns the location that they're in.
Autonumber: This one just finds the next available number for the script, and sticks it in for it. This is only for scripts that you won't ever call from inside the engine, but rather just from other scripts. It basically just makes the script not take up any of your numbers for other scripts... something of that sort.
Days of Play: This simply tells how many 24 hour sets the player has been with the game. (Real time, not game time.) This could be useful if you want the game to be completed in 24 hours of play, lest the heros fail in their mission. In this case, the code would be written:
if(days of play == 1), then
(
game over
)
Define Constant: constants are simply variables that you don't want changed, like say if you were using the number Pi, aka ~3.14159, which you probably wouldn't want to have anything changed about it. So you'd define it as a constant. I've not used this command before, so I'd have to look into it to see exactly what the syntax and such for it is, so I'll edit this post once I get a chance.
Divide, Subtract, Equal, etc: All of these just replace their operators (aka the + symbol, the - symbol, the = symbol when used in an if statement or while statement, etc) and are placed as such in code:
HeroHP := 6,add,5,subtract,11
As for Mod, that's just (if you remember from division with remainders) the remainder. EG, 4,mod,2 would return 0 (no remainder) where as 5,mod,2 would return 1 (one remainder).
Or: Or is used when you want something to happen if one, the other, or both statements are true/false.
EG:
if((VariableX == 3),or,(VariableY == 3)),then
(
#insert code here
)
this will make the code happen when Variable X = 3, when Variable Y = 3, or when both = 3.
Random: this is useful when making mini-games or the like, where you don't want the answer to the problem to be the same all the time. EG, the pearl game in Wandering Hamster (although I'm not quite sure if that actually uses random, I'll have to look in the code sometime.)
Rank In Caterpillar: This lets you know where in the party the hero is, or if he's not in it. Useful if you want to move a certain character via walkhero but don't know what position he is in, because the player may have changed it.
Variable: Variables store numbers for later use. If you use a global variable, it holds that number until you change it. If you use a local (or just Variable) variable, it lasts only until the script ends, then it's returned to 0. (As a note, all variables default, or start off as, 0.)
While: These are used for loops, where you want something to happen until the player meets a certain condition, perhaps flipping a tag on somehow. For instance,
while(checktag(2)==true),do
(
#whatever happens until Tag 2 is set to False, or turned off.
)
If: This checks to see if whatever in the '(' and the ')' is true.
EG:
if(checktag(2) == true),then
(
#put stuff in here that'll happen if tag 2 is on, or true, at the time of
#this checking
)
else
(
#put stuff in here that (if you want it to) will happen if tag 2 isn't on,
#or true.
)
xor: Can't help you with this one, I've forgotten what it does. Perhaps someone else can though
Hope this helps. If you have any questions, feel free to post 'em. I always check the plotscripting forum.  _________________ * SDHawk has joined #Minnek
SDHawk> AAAAAAAAAAAAAUUUUUUUUUGH
* SDHawk has left #Minnek (Leaving) |
|
Back to top |
|
 |
Mortem Monkey

Joined: 19 Sep 2003 Posts: 19 Location: Deep in to the recesses of your mind.
|
Posted: Mon Oct 27, 2003 6:28 pm Post subject: Thanks. |
|
|
Thanks, Minnek. Do you think you could write up some more examples for me? Like say a simple script to show me how to use the command in a script of my own. _________________ If you don't believe that God has a sense of humor then you explain the french! |
|
Back to top |
|
 |
Minnek Conjurer

Joined: 03 Jun 2003 Posts: 430 Location: Somewhere
|
Posted: Mon Oct 27, 2003 6:35 pm Post subject: |
|
|
Sure, give me a bit and I'll get either an .html document put together, or just a .txt file. I finally can put my uber-plotscripting-knowledge to use! or something.  _________________ * SDHawk has joined #Minnek
SDHawk> AAAAAAAAAAAAAUUUUUUUUUGH
* SDHawk has left #Minnek (Leaving) |
|
Back to top |
|
 |
Aethereal SHUT UP. Elite Designer


Joined: 04 Jan 2003 Posts: 928 Location: Gone! I pop in on occasion though.
|
Posted: Mon Oct 27, 2003 7:53 pm Post subject: |
|
|
I can give you a quick example of how findhero() can be helpful.
Let's say you want to force-equip a hammer on Bob, but you don't know what slot Bob is in (since the player can freely move Bob around in the order). You would use findhero() to find out what position Bob is in, and then that way it would always be equipped to the correct character. For example:
force equip (0, slot:weapon, 10) #Item 10 is the hammer
That will equip the hammer you want placed onto Bob on the character who is in slot 0. But what happens if a different character is in slot 0? You wanted it equipped on Bob, not on someone else. So, what you would do is use this:
force equip (find hero(hero:bob), slot:weapon, 10)
That way, no matter what position in the party Bob was in, it would equip the hammer to Bob.
The operators (add/subtract/divide/multiply) can be useful for manipulating variables, because variables can be any number. Of course you'll know what two times two is, but do you know what n times two is? Since n is a variable, you cannot determine that (well, not without setting it equal to something and solving, but that's beside the point). If n is manipulated in different ways in the script, you would use n * 2 to double n, and then you could do different things with value n, such as returning it or something.
Or can be used to check to see if one of two things is true or false. Let's say...you're scripting a lottery game, and through some variable manipulation (and usage of that random() function) the two winning numbers, represented by variables x and y, are x=3 and y=7 (and the player just has to pick one of the two winning numbers to win). Let's say that variable z is the number that the player has picked. You would set up something like this:
Code: |
if(x==z, or, y==z)
then(
#You win the lottery!
)
end
|
Okay, Rank in Caterpillar...alright. Let's say you want to walk hero Bob up four spaces, but you aren't sure what slot in the party Bob is in. Findhero() will not work for this, because it returns what position the hero is located in, but not what position *in the caterpillar party* s/he is in (correct me on that if I am wrong). So, if you wanted to walk hero Bob up four but don't know what slot Bob is in, use:
Code: |
walk hero(rank in caterpillar(hero:bob), up, 4)
|
If you don't understand what variables are for, then you should not try anything beyond walking heroes and showing textboxes in plotscripting right now. A variable is just a word, letter, or symbol that represents a number. The number can be anything. You can use setvariable() to change what number the variable represents. Variables can be used to create mini-games, make alternate things happen in certain situations, or even write whole battle systems! Variables are really too broad to go into too much detail about, but they are extremely important to learn how to use. You can use if-then to check a variable's value and do certain commands based on what the value is (i.e., do this if variable n is less than 5, and do something else if it is more than 5). Don't forget that you can combine things in setvariable(). For example:
Code: |
setvariable(n, n+5)
|
That will take whatever number n is and increase it by five, and that will become the new value of n.
While loops aren't used much except in very complex plotscripting. They can be useful for mini-games though. Basically, while() just checks the conditional in the parentheses (i.e. while(x==5)), and then if the conditional returns true, it runs whatever you place in the do() block following while(). While loops are often used to stop the player from
doing something without using suspend player, as well as run a lot of commands and let the player take over later. However, let's use a simple example of a while loop.
Code: |
variable (i)
set variable (i, true)
while (i==true)
do(
if (key is pressed(01)) #ESC key breaks the loop!
then(
set variable (i, false)
end
end
wait(1)
end
|
With that block of code, the while loop will run over and over and over until the player presses ESC, at which the game realizes "Hey, you pressed ESC, that means set variable i to a false value!" Now that i is false, the while loop does not return true (since i is no longer true), and the loop doesn't run, and the script continues on as normal. While loops are almost always used in conjunction with the key is pressed function, as it is the single most effective way to utilize key is pressed.
If-then flow is very easy and very, VERY important. All it does is say "If this is true, then do this". For example:
Code: |
variable (n)
set variable (n, 5)
if (n==5) #If n equals five (which is true)
then( #Then do the commands in this THEN block.
set variable (n, 6) #The command is to change variable n to a value of six.
end #This end command means to close the THEN block.
end
|
If-then also contains an ELSE block, which is used if the IF block is false. It is basically "If this is not true, don't run what is in the THEN block, run what is in the ELSE block".
I'm going to paste a clip from OHR Arena's script to show an example of how these can REALLY work together.
Code: |
if(check equipment(findhero(hero:wizardF), slot:OffHand) == 100)
then(
writespell(find hero(hero:wizardF), 0, 0, atk:Flareblast)
writespell(find hero(hero:wizardF), 0, 12, atk:EarthSpire)
writespell(find hero(hero:wizardF), 0, 13, atk:Stone Axe)
)
|
All this basically says is:
If hero WizardF has item 100 in his Off-Hand equipment slot, then write those three spells to his spells list.
The detailed breakdown:
if(check equipment(findhero(hero:wizardF), slot:OffHand) == 100)
The checkequipment() command basically finds a hero (in this case, using findhero), and you indicate a slot, and it returns the number of the item in that slot (the number being the same as the number next to it in the items list of the editor). In this case, I'm asking it to check what is in the off-hand of WizardF, and if it is item 100 (== 100), then do what is in the THEN block.
That is what I can help you on for now. Other stuff I could say would be something like "study Wandering Hamster's scripts and practice scripting". Scripting isn't something you learn to do overnight, although with a little practice, scripting more complex stuff will eventually become easy. _________________
 |
|
Back to top |
|
 |
Mad Cacti Guest
|
Posted: Tue Oct 28, 2003 12:51 am Post subject: |
|
|
As for xor:
xor means exclusive or. It returns true when one, but not the other, condition is true. If both are true or both false, it returns false.
So
(true, xor, 0)
returns true. |
|
Back to top |
|
 |
|
|
You can post new topics in this forum You can reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|