Variables
Anonymous
27 Sept 2003, 17:25How do I make variables. For example I want 'Variable' = 1
And how do I check if a 'Variable' equals to 1 and not 2.
And how do I add to a varialbe, for example 'Variable' = 'Variable' + 1
Thank you.
And how do I check if a 'Variable' equals to 1 and not 2.
And how do I add to a varialbe, for example 'Variable' = 'Variable' + 1
Thank you.
Farvardin
27 Sept 2003, 19:44a short example from my code :
to define a variable :
to check and change it :
all this is well explained in the Quest Manual
to define a variable :
define variable <chair_move>
type numeric
value <6>
onchange do <take_rope> ' it's a call to a procedure
end defineto check and change it :
command <push #@object1#> {
'the test :
if ( #object1# = table ) then {
if ( %table_move% > 0 ) and ( %table_move% < 11 ) then {
msg <You push the table.>
' it's for decreasing the variable as you can guess...
dec <table_move>
}
else msg <There is a wall preventing you to move anymore.>
}
all this is well explained in the Quest Manual
GameBoy
27 Sept 2003, 20:35that first post completely confused me...
and if hes a newbie i wouldnt print all that out too him, he'll run away in confusion! lol
let me see if i can explain....
you want a variable set as 1. so in QDK (if you're using this), set numeric variable as 1. then when you want to check if the variable is 1 (im assuming you want a condition), then all you have to do is set a condition like so....
IF %variable% = 1
THEN blahdeblahdeblah
as for adding to a variable i THINK its %variable% + 1 (you'll have to check up on this)
im not really an ASL coder, nor do i tend to learn it, so if im wrong with this correct me.
and if hes a newbie i wouldnt print all that out too him, he'll run away in confusion! lol
let me see if i can explain....
you want a variable set as 1. so in QDK (if you're using this), set numeric variable as 1. then when you want to check if the variable is 1 (im assuming you want a condition), then all you have to do is set a condition like so....
IF %variable% = 1
THEN blahdeblahdeblah
as for adding to a variable i THINK its %variable% + 1 (you'll have to check up on this)
im not really an ASL coder, nor do i tend to learn it, so if im wrong with this correct me.
Anonymous
27 Sept 2003, 22:56I must say that Ste was right...
The first post was kinda confusing, nut im sure that it will help me anyway.
Thanks and I will try that.
The first post was kinda confusing, nut im sure that it will help me anyway.
Thanks and I will try that.
Farvardin
28 Sept 2003, 07:23if you get the example of how a variable works, it will help you to implement some in your game, even if you don't understand all.
I think the definition itself is easy to understand. It's not lile in other languages like C for ex. For things like "type" and such, read the manual for more informations.
For a test on a variable, just use this syntaxt (with the same parentheris) :
if ( %chair_move% = 0 ) then {
code /.../etc. (other kind of tests are in the manual)
in my example I used a name of variable different that the one shown in the definition, because it was another part of the code. I must admit it can be quite confusing.
I suggest also you download a few games on the quest website, and search for code with variables in them, and adapt it for your own purposes.
I think the definition itself is easy to understand. It's not lile in other languages like C for ex. For things like "type" and such, read the manual for more informations.
For a test on a variable, just use this syntaxt (with the same parentheris) :
if ( %chair_move% = 0 ) then {
code /.../etc. (other kind of tests are in the manual)
in my example I used a name of variable different that the one shown in the definition, because it was another part of the code. I must admit it can be quite confusing.
I suggest also you download a few games on the quest website, and search for code with variables in them, and adapt it for your own purposes.
codingmasters
01 Nov 2003, 05:50make sure the files you download are ASl files and CAS files! You can tell which one they are by looking next to the text 'Download' in the game description on the website
Matthew G.
Matthew G.