A n00b question
Jodan
14 Dec 2003, 19:30I finally got Quest Pro after completly raping Axe Software of their generosity by keeping the demo for a good 3 months. Now at least I feel entitled to ask questions without sounding like a begger on the street. Here's my first one.
I have experience programming in Visual Basic only, unfortunatly, so as simple as you possibly can, please explain:
What's the purpose of $, %, !, and any other icons that don't seem to mean anything unless you have experience. I've looked in lots of books, they always seem to assume you know these things!
Also, i'm trying to make this program, you see, in which I need to assign probabilities for certain things to happen. I'm created variables which have 35/100 and 65/100 (35% and 65%), but I don't know how to make is so 'upon this event, there's a 35/100 chance THIS will happen and a 65/100 chance THIS will happen'. I could really use some help with that... it's part of a school project that's due tomarrow... oops
Well, no pressure. If you can help me, be so kind.
I appreciate the help.
I have experience programming in Visual Basic only, unfortunatly, so as simple as you possibly can, please explain:
What's the purpose of $, %, !, and any other icons that don't seem to mean anything unless you have experience. I've looked in lots of books, they always seem to assume you know these things!
Also, i'm trying to make this program, you see, in which I need to assign probabilities for certain things to happen. I'm created variables which have 35/100 and 65/100 (35% and 65%), but I don't know how to make is so 'upon this event, there's a 35/100 chance THIS will happen and a 65/100 chance THIS will happen'. I could really use some help with that... it's part of a school project that's due tomarrow... oops
I appreciate the help.
Cryophile
14 Dec 2003, 19:41To answer your questions:
% surrounds numeric variables -- example: %hp%
# surrounds string variables -- example: #player#
To my knowledge, ! is only used in status variables and as the NULL. This isn't used too often.
For conditional statements, you use the 'if'.
I tried to answer your other question as well. $rand is used to produce random numbers. $rand(firstnumber;lastnumber)$
So if you wanted to check for $rand(35;100)$ and $rand(65;100)$ you do this:
Hopefully this is what you asked for and will help at least a little.
% surrounds numeric variables -- example: %hp%
# surrounds string variables -- example: #player#
To my knowledge, ! is only used in status variables and as the NULL. This isn't used too often.
For conditional statements, you use the 'if'.
if ( $rand(1;100)$ == 3) then {
do this if the number 3 came up in a random 1/100
}
I tried to answer your other question as well. $rand is used to produce random numbers. $rand(firstnumber;lastnumber)$
So if you wanted to check for $rand(35;100)$ and $rand(65;100)$ you do this:
if ( $rand(1;100)$ <= 35) and ( $rand(1;100)$ <= 65) then {
do this if the random number generator produces a number between 1 and 35 AND a number between 1 and 65
}
Hopefully this is what you asked for and will help at least a little.
Jodan
14 Dec 2003, 19:53Thanks a lot, that's a big help.
A few more: What's the difference between = and ==? What's The NULL mean? Is there a difference between a status and a normal variable?
As for the code you gave me, it's VERY helpful, I appreciate it greatly.
A few generalities however:
Why would you put and? Wouldn't that mean it would do the same thing no matter what number it got? I'm trying to make it so if it's between 1 and 35, THIS happens, but if it's between 35 and 100, THIS happens.
Also, why does one put a space between ( and $rand? How do you know when not to do this?
Once again, thank you so much, if i'm beggining to bother ya or get annoying, just say the word. You've done quite enough for me as is.
A few more: What's the difference between = and ==? What's The NULL mean? Is there a difference between a status and a normal variable?
As for the code you gave me, it's VERY helpful, I appreciate it greatly.
A few generalities however:
if ( $rand(1;100)$ <= 35) and ( $rand(1;100)$ <= 65) then {
do this if the random number generator produces a number between 1 and 35 AND a number between 1 and 65
} Why would you put and? Wouldn't that mean it would do the same thing no matter what number it got? I'm trying to make it so if it's between 1 and 35, THIS happens, but if it's between 35 and 100, THIS happens.
Also, why does one put a space between ( and $rand? How do you know when not to do this?
Once again, thank you so much, if i'm beggining to bother ya or get annoying, just say the word. You've done quite enough for me as is.
Cryophile
14 Dec 2003, 19:591. I'm not sure about Quest, but in some systems the = assigns the variable and the == evaluates it. I don't think there's a difference here.
2. Null is used when the variable doesn't exist and you try to evaluate it. For example, if you check to see if the attack variable is equal to 3, and there IS no attack variable, then it gives null (!)
3. Sorry about the 'and'. I misinterpreted. I assumed you wanted to check for both at once. If you want to check for one, remove the 'and' and everything until the 'then'. Then, in the else statement, make a new conditional to check for 35-100.
4. There is absolutely no difference between if ($rand and if ( $rand
The space means nothing. In complex scripts, it can increase readability, however. That's why I used it.
Any other questions?
2. Null is used when the variable doesn't exist and you try to evaluate it. For example, if you check to see if the attack variable is equal to 3, and there IS no attack variable, then it gives null (!)
3. Sorry about the 'and'. I misinterpreted. I assumed you wanted to check for both at once. If you want to check for one, remove the 'and' and everything until the 'then'. Then, in the else statement, make a new conditional to check for 35-100.
4. There is absolutely no difference between if ($rand and if ( $rand
The space means nothing. In complex scripts, it can increase readability, however. That's why I used it.
Any other questions?
GameBoy
14 Dec 2003, 20:44Jordon how well you know Visual Basic.
Slayer....
Will you marry me?
Slayer....
Will you marry me?
Jodan
14 Dec 2003, 20:55I know it well enough. I took a 30 hour college course at Hunter University. Is there something I could help you with? Always happy to be of service.
GameBoy
14 Dec 2003, 21:31well me and my buddy are coding a client which connects to the QuestNet server. Basically, we were bored, and decided we would start a project to see if we could make a custom client for our game. Now, it's so simple because the server handles all the ASL, and the client just sends commands to the server as the Quest client does. so using player pics would be so simple.
Anyway, if you wanna work with us, please contact tekronx@hotmail.com (do not email this, for MSN use only), and talk to him about it as he is the head coder. thanks.
Anyway, if you wanna work with us, please contact tekronx@hotmail.com (do not email this, for MSN use only), and talk to him about it as he is the head coder. thanks.
Cryophile
14 Dec 2003, 22:45Ste wrote:
Slayer....
Will you marry me?
WTF?!
BTW, I could help with the client if you want (in C/C++).
GameBoy
14 Dec 2003, 23:56ok, guys.... This could be cool. If you are good in VB, this could mean making a whole NEW project (after im done with this). with 3 (excluding me as i dont code in VB/C++) coders, it should be alot easier to make a WHOLE stand alone game with a nice looking server. If you are both willing to help, we can get Feudal Online back on it's feet again. email ste_edwards16@hotmail.com (or add to MSN), if interested.
codingmasters
15 Dec 2003, 00:20I'm willing to help out to on this project. I know VB6 pretty well, the only problem is that I'm living in Australia. u can email me @ codingmasters@yahoo.com.au
Matthew G.
Matthew G.
Jodan
15 Dec 2003, 02:32Another question- it won't let me compile the program, it says 'too many }', but I seem to have just the right amount....
paul_one
15 Dec 2003, 05:44Putting a space in there is good because it stops bugs too - which I've heard from Al. Quest trims the spaces from the beginning and end of different things so you need to use a special thingy if you want spaces before or after something (like to make a variable = " hi ").
The == is usually in C/C++ based stuff, like Java and whatever. Basic makes it simple by having = both assign and compare (which - let's face it - is easier for the programmer).
..... that's for the 35/100 probability. Change the numbers to 65 if you want the other probability.
To your final question Jordan - you have too many }'s... Simple really.
Check through it and you should find you have one or two more }'s than {'s .
The == is usually in C/C++ based stuff, like Java and whatever. Basic makes it simple by having = both assign and compare (which - let's face it - is easier for the programmer).
set num <var1; $rand(1:100)$>
if ( %var1% < 35 ) then {
msg <Below 35>
}
else {
if ( %var1% >= 35 ) then {
msg <Larger than 35>
}
}..... that's for the 35/100 probability. Change the numbers to 65 if you want the other probability.
To your final question Jordan - you have too many }'s... Simple really.
Check through it and you should find you have one or two more }'s than {'s .
Jodan
15 Dec 2003, 16:45Funny, I checked through the damned thing a good half dozen times, I keep getting an equal number of both... I'll try more.
Ok, I definitly checked it enough times. I have 7 { and 7 }, and they all seem to be in proper place. If there's anything obvious i'm missing...
I appreciate someone mentioning it to me
Ok, I definitly checked it enough times. I have 7 { and 7 }, and they all seem to be in proper place. If there's anything obvious i'm missing...
' "The Monster Program: An Experiement in AI"
' Created with QDK Pro 3.12
define game <The Monster Program: An Experiement in AI>
asl-version <311>
start <The Laboratory>
game author <J.M.Francia>
game version <1.0>
game copyright <J.M.Francia>
game info <-Created with QDK Pro 3.12|n-Special thanks to:|nMy parents for funding and support |nMr. "Shweabizzle" for... uh... grading it>
command <Instructions> msg <Try typing 'Help'>
command <Help> msg <To give the creature an object, type 'give *object*', such as 'give apple', 'give ball', or 'give bow and arrow'. Once the creature reacts to the object, a pop-up menu will show, asking you what to do to the creature. If you choose 'Give Treat', the creature will be rewarded with a treat, and will be much encouraged to react that way again in the future. If you choose 'Pet', he'll be moderatly encouraged to react that way again in the future. If you choose 'Ignore', he won't be encouraged to do anything in particular. If you choose 'Slap', he'll be moderatly discouraged to react that way in the future. If you choose 'Beat', he'll be very discouraged to react that way in the future. Simple, ain't it? Type in 'Credits' for credits of the program's production and design, and type 'quit' to exit the program. >
define variable <1VintelligentX>
type numeric
value <5>
end define
define variable <1IntelligentX>
type numeric
value <20>
end define
define variable <1Unintelligent1x>
type numeric
value <55>
end define
define variable <1Unintelligent2X>
type numeric
value <90>
end define
define variable <Punnishment>
type numeric
value <0>
end define
define variable <Reaction>
type numeric
value <!>
end define
end define
define synonyms
end define
define room <The Laboratory>
look <This is where the experiment will take place. The monster, fondly nicknamed "Toey", stands before you, with an obvious urge to learn. On your desk lays three objects: An apple, A ball, and a bow and arrow. To give one to him, simply type give 'object'. Such as give apple or give bow and arrow.>
define object <Apple>
prefix <An>
displaytype <Object>
article <it>
gender <it>
end define
define object <Ball>
prefix <a>
suffix <\>
displaytype <Object>
article <it>
gender <it>
end define
define object <Bow and Arrow>
prefix <A>
displaytype <Object>
article <it>
gender <it>
end define
end define
define procedure <Applereactioncheck>
if ( $rand(1;100)$ <= $Punnishment$ ) then msg <He's too afraid to do anything due to fear of punnishment.Try again.>
if ( $rand(1;100)$ <= $1VintelligentX$ ) then {
msg <He takes the apple, looking it over momentarily, before taking a knife and cutting it evenly into peices, eating each neatly and individually.|n|nReaction= Very Intelligent>
timeron <Punnishment Menu>
set numeric <Reaction; 0>
}
if ( $rand(1;100)$ > $1Vintelligentx$ ) and ( $rand(1;100)$ <= $1ntelligentx1 ) then {
msg <He takes the apple, sniffs it, then takes a bite.|n|nReaction = Intelligent.>
timeron <Punnishment Menu>
set numeric <Reaction; 1>
}
if is <$rand(1;100)$; gt; $1intelligentx$> and ( $rand(1;100)$ <= $1unintelligent1x$ ) then {
msg <He sniffs the apple, then for one reason or another, begins to rub it against his body. How strange.|n|nReaction= Not very intelligent>
timeron <Punnishment Menu>
set numeric <Reaction; 2>
}
if ( $rand(1;100)$ > $1unintelligent1x$ ) and ( $rand(1;100)$ <= $1unintelligent2x$ ) then {
msg <He takes the apple, looks at it for a bit. Then he looks at you. Then back to the apple. Then at you. With a swift motion, the apple is ricocheted off of your head. |n|nReaction = Not very intelligent>
timeron <Punnishment Menu>
set numeric <Reaction; 3>
}
if ( $rand(1;100)$ > $1unintelligent2x% ) then {
msg <He takes the apple fondly, before, with barely a moment's hesitation, he baps it against his own forehead. Again. And again. And again. He continues to repeat this neurotic act for no apparent reason whatsoever, apple bits flying about.|n|nReaction = Very unintelligent>
timeron <Punnishment Menu>
set numeric <Reaction; 4>
}
end define
define function <Applegive>
{
msg <You give Toey an apple.>
do <Applereactioncheck>
}
end define
define timer <Punnishment Menu>
interval <4>
action choose <Punishment menu>
disabled
end define
define text <intro>
Welcome, ladies and gents, to J.M.Francia's experiment in Artificial Intelligence. It's quite simple: There is a hypothetical creature before you, who will react differently to different objects that are given to him. Once he interacts with the object, you may praise or punnish him to encourage or discourage behavior. If he reacts by interacting the way in which you praised him, then he is actively learning, and the program is a success. Let's begin.
end define
define text <win>
end define
define text <lose>
end define
define selection <Punishment menu>
info <How do you wish to react?>
choice <Give him a treat> {
msg <He giggles with glee as you give him the tastey morsel. >
if ( Reaction = 0 ) then set numeric <Vintelligentx; $Vintelligentx$ + 10>
}
choice <Pet him>
choice <Ignore him>
choice <Slap him>
choice <Beat him>
end defineI appreciate someone mentioning it to me
GameBoy
15 Dec 2003, 18:31problem is...(well, atleast i THINK this is a problem), you are using....
instead of....
in some of the script. i dont think you're supposed to use )'s and ('s for the tags.
if ( $rand(1;100)$ <= $Punnishment$ ) then msg <He's too afraid to do anything due to fear of punnishment.Try again.>
instead of....
if < $rand(1;100)$ <= $Punnishment$ > then msg <He's too afraid to do anything due to fear of punnishment.Try again.>
in some of the script. i dont think you're supposed to use )'s and ('s for the tags.
I think Im Dead
15 Dec 2003, 19:59Ste wrote:problem is...(well, atleast i THINK this is a problem), you are using....if ( $rand(1;100)$ <= $Punnishment$ ) then msg <He's too afraid to do anything due to fear of punnishment.Try again.>
instead of....if < $rand(1;100)$ <= $Punnishment$ > then msg <He's too afraid to do anything due to fear of punnishment.Try again.>
in some of the script. i dont think you're supposed to use )'s and ('s for the tags.
Wrong, try again.
GameBoy
15 Dec 2003, 20:34so you're allowed to use ( and ) instead of < and > ? i didnt know that.... 
Cryophile
15 Dec 2003, 21:30Another thing is that every one of your variables is wrong. You use things like $punishment$ rather than %punishment% (for numbers) or #punishment# (for text). You use $punishment$ if you made a function. Then the $punishment$ would return whatever was specified as the return value in your function. Since you have no functions, use %punishment%.
Also, Ste, what the $&@!# advice are you trying to give? You use ( ) NOT < > for IF statements. If you used <> an error would be given and Quest would crash.
Obviously Ste doesn't know half as much as he thinks he does.
Also, Ste, what the $&@!# advice are you trying to give? You use ( ) NOT < > for IF statements. If you used <> an error would be given and Quest would crash.
Obviously Ste doesn't know half as much as he thinks he does.
Cryophile
15 Dec 2003, 21:56Here is your revised code. It should work fine.
There was one thing I could not figure out, so I didn't change it. That was this line:
' "The Monster Program: An Experiement in AI"
' Created with QDK Pro 3.12
define game <The Monster Program: An Experiement in AI>
asl-version <311>
start <The Laboratory>
game author <J.M.Francia>
game version <1.0>
game copyright <J.M.Francia>
game info <-Created with QDK Pro 3.12|n-Special thanks to:|nMy parents for funding and support |nMr. "Shweabizzle" for... uh... grading it>
command <Instructions> msg <Try typing 'Help'>
command <Help> msg <To give the creature an object, type 'give *object*', such as 'give apple', 'give ball', or 'give bow and arrow'. Once the creature reacts to the object, a pop-up menu will show, asking you what to do to the creature. If you choose 'Give Treat', the creature will be rewarded with a treat, and will be much encouraged to react that way again in the future. If you choose 'Pet', he'll be moderatly encouraged to react that way again in the future. If you choose 'Ignore', he won't be encouraged to do anything in particular. If you choose 'Slap', he'll be moderatly discouraged to react that way in the future. If you choose 'Beat', he'll be very discouraged to react that way in the future. Simple, ain't it? Type in 'Credits' for credits of the program's production and design, and type 'quit' to exit the program. >
define variable <1VintelligentX>
type numeric
value <5>
end define
define variable <1IntelligentX>
type numeric
value <20>
end define
define variable <1Unintelligent1x>
type numeric
value <55>
end define
define variable <1Unintelligent2X>
type numeric
value <90>
end define
define variable <Punishment>
type numeric
value <0>
end define
define variable <Reaction>
type numeric
value <0>
end define
end define
define synonyms
end define
define room <The Laboratory>
look <This is where the experiment will take place. The monster, fondly nicknamed "Toey", stands before you, with an obvious urge to learn. On your desk lays three objects: An apple, A ball, and a bow and arrow. To give one to him, simply type give 'object'. Such as give apple or give bow and arrow.>
define object <Apple>
prefix <An>
displaytype <Object>
article <it>
gender <it>
end define
define object <Ball>
prefix <a>
suffix <\>
displaytype <Object>
article <it>
gender <it>
end define
define object <Bow and Arrow>
prefix <A>
displaytype <Object>
article <it>
gender <it>
end define
end define
define procedure <Applereactioncheck>
if ( $rand(1;100)$ <= %Punishment% ) then msg <He's too afraid to do anything due to fear of punishment.Try again.>
if ( $rand(1;100)$ <= %1VintelligentX% ) then {
msg <He takes the apple, looking it over momentarily, before taking a knife and cutting it evenly into peices, eating each neatly and individually.|n|nReaction= Very Intelligent>
timeron <Punishment Menu>
set numeric <Reaction; 0>
}
if ( $rand(1;100)$ > %1Vintelligentx% ) and ( $rand(1;100)$ <= %1ntelligentx1% ) then {
msg <He takes the apple, sniffs it, then takes a bite.|n|nReaction = Intelligent.>
timeron <Punishment Menu>
set numeric <Reaction; 1>
}
if is <$rand(1;100)$; gt; %1intelligentx%> and ( $rand(1;100)$ <= %1unintelligent1x% ) then {
msg <He sniffs the apple, then for one reason or another, begins to rub it against his body. How strange.|n|nReaction= Not very intelligent>
timeron <Punishment Menu>
set numeric <Reaction; 2>
}
if ( $rand(1;100)$ > %1unintelligent1x% ) and ( $rand(1;100)$ <= %1unintelligent2x% ) then {
msg <He takes the apple, looks at it for a bit. Then he looks at you. Then back to the apple. Then at you. With a swift motion, the apple is ricocheted off of your head. |n|nReaction = Not very intelligent>
timeron <Punishment Menu>
set numeric <Reaction; 3>
}
if ( $rand(1;100)$ > %1unintelligent2x% ) then {
msg <He takes the apple fondly, before, with barely a moment's hesitation, he baps it against his own forehead. Again. And again. And again. He continues to repeat this neurotic act for no apparent reason whatsoever, apple bits flying about.|n|nReaction = Very unintelligent>
timeron <Punishment Menu>
set numeric <Reaction; 4>
}
end define
define procedure <Applegive>
msg <You give Toey an apple.>
do <Applereactioncheck>
end define
define timer <Punishment Menu>
interval <4>
action choose <Punishment menu>
disabled
end define
define text <intro>
Welcome, ladies and gents, to J.M.Francia's experiment in Artificial Intelligence. It's quite simple: There is a hypothetical creature before you, who will react differently to different objects that are given to him. Once he interacts with the object, you may praise or punnish him to encourage or discourage behavior. If he reacts by interacting the way in which you praised him, then he is actively learning, and the program is a success. Let's begin.
end define
define text <win>
end define
define text <lose>
end define
define procedure <givetreat>
msg <He giggles with glee as you give him the tastey morsel. >
if ( Reaction = 0 ) then set numeric <Vintelligentx; $Vintelligentx$ + 10>
end define
define selection <Punishment menu>
info <How do you wish to react?>
choice <Give him a treat> do <givetreat>
choice <Pet him>
choice <Ignore him>
choice <Slap him>
choice <Beat him>
end define
There was one thing I could not figure out, so I didn't change it. That was this line:
if is <$rand(1;100)$; gt; %1intelligentx%> and ( $rand(1;100)$ <= %1unintelligent1x% ) then {
msg <He sniffs the apple, then for one reason or another, begins to rub it against his body. How strange.|n|nReaction= Not very intelligent>
timeron <Punishment Menu>
set numeric <Reaction; 2>
}
Jodan
16 Dec 2003, 00:21God bless ya, sir! ....But why did it say I had too many }? An error in the program itself with detecting the cause of the problem?
I know i'm going to be asking a lot of questions concerning programming here, but don't worry, i'm learning a lot by reading old posts and such, so i'll bug you all less as time goes on.
I know i'm going to be asking a lot of questions concerning programming here, but don't worry, i'm learning a lot by reading old posts and such, so i'll bug you all less as time goes on.
GameBoy
16 Dec 2003, 08:22S1aY3R wrote:
Also, Ste, what the $&@!# advice are you trying to give? You use ( ) NOT < > for IF statements. If you used <> an error would be given and Quest would crash.
Obviously Ste doesn't know half as much as he thinks he does.
Actually "S1aY3R", like i said, i didnt know. and where have i ever said...."i know alot about ASL". I remember one post of mine which said "Dont look to me for help as i dont know ASL that much". Not once have i said i'm fluent in it. jeez
Cryophile
16 Dec 2003, 18:16Jodan:
You were using the braces {} for procedures and such. They are not meant to be used in that form so Quest gave the only error it could think of - Too many }
Ste:
I was merely exasperated that you made a comment as stupid as you did. I meant only a little offense. You gave advice for using < > when you've been using the ( ) every time you code in ASL. This was so strange...
Also, I don't recall you saying you know a lot about ASL. Read it again and you should understand my meaning.
You were using the braces {} for procedures and such. They are not meant to be used in that form so Quest gave the only error it could think of - Too many }
Ste:
I was merely exasperated that you made a comment as stupid as you did. I meant only a little offense. You gave advice for using < > when you've been using the ( ) every time you code in ASL. This was so strange...
Also, I don't recall you saying you know a lot about ASL. Read it again and you should understand my meaning.
Cryophile
16 Dec 2003, 21:45
define procedure <givetreat>
msg <He giggles with glee as you give him the tastey morsel. >
if ( Reaction = 0 ) then set numeric <Vintelligentx; $Vintelligentx$ + 10>
end define
This must have slipped past me when I revised your code. It should be:
define procedure <givetreat>
msg <He giggles with glee as you give him the tastey morsel. >
if ( Reaction = 0 ) then set numeric <Vintelligentx; %Vintelligentx% + 10>
end define
You wouldn't notice the error until Quest crashed. Sorry
Jodan
16 Dec 2003, 23:29Well that's odd, I never even edited the code to include or uninclude {}. Oh well. Que Sara Sara...
And thank you VERY much, once again.
And thank you VERY much, once again.
paul_one
17 Dec 2003, 08:26Ste - just to point out that when you use more or less than signs "<" and ">" in the actual IF then Quest would get awfully confused by;
if < ggg > llll > then {
How would it know that the second > means more than?
if < ggg > llll > then {
How would it know that the second > means more than?
GameBoy
17 Dec 2003, 15:12ahhh i getcha, thanks CW