RMRK is retiring.
Registration is disabled. The site will remain online, but eventually become a read-only archive. More information.

RMRK.net has nothing to do with Blockchains, Cryptocurrency or NFTs. We have been around since the early 2000s, but there is a new group using the RMRK name that deals with those things. We have nothing to do with them.
NFTs are a scam, and if somebody is trying to persuade you to buy or invest in crypto/blockchain/NFT content, please turn them down and save your money. See this video for more information.
Problems with a script I made... (I'm a newb scripter...)

0 Members and 1 Guest are viewing this topic.

***
Rep:
Level 86
I hate everyone except the ones I don't hate...
Okay. First of all, this was just for fun, nothing fancy, also the first thing I've ever done with scripting. I just wanted something very simple, it's only about 10- 20 lines. Please, don't get harsh, this was just a first-try with the Scite editor thing.

Okay, now I just wanted to make an event in rmxp, asking you for gender and then age. If you chose to be a "Boy" then I used a call script to type:
(Note that I also tried doing it with "var_girl")
Code: [Select]
gen_girl = false
If u chose to be a girl, it'd become true.

Then afterwards, you're asked if you're old or young. Simple too:
You choose to be "Old" I call script and it says:

Code: [Select]
age_old = true
If you chose to be young, then it'd be
Code: [Select]
age_young = true

But enough talk, I get an error. The whole script:

Code: [Select]
if age_old == true
 then age_young = false
elsif age_old == false
 then age_young= true
 end
end
# Theres about 10 lines of comments here XD...
if age_old == true
  then p "I am an old idiot"
 elsif age_young == true
  if gen_girl == false
   then p "I am a young boy"
  elsif gen_girl == true
      then p "I am a young girl"
   end
 end
end

The error is on line 6. I called the script "Age_Gender"
Tell me if you need more info about it, 'cuz I'll try to get it then.
I wonder how many of my-reps are there for a reason, and not just because some jackass wanted to show off in front of some other jackasses...?
Probably a lot of them - and those people sure as hell don't deserve my pity, let alone my disgust.
That's right, let's see some more -Rep'ing! BOOYEAH!!

**
Rep:
Level 86
Looks like you have 1 too many 'end's in there.
Code: [Select]
if age_old == true
  then age_young = false
elsif age_old == false
  then age_young= true
end
end

See?

***
Rep:
Level 86
I hate everyone except the ones I don't hate...
NOTE: These errors come when I start the game, not after talking to the event!
Now: What do u mean? That's not how I wrote it. I wrote:
Code: [Select]
  end
end

not
Code: [Select]
end
end
But does it make a difference?

EDIT:
I tried removing one of the ends. Now I have an error at line 26. That's another end. I remove that and I get an error in line 1:
Code: [Select]
if age_old == true
It might be because I deleted the wrong end, I'm gonna try that right now...

EDIT: Same problem...  :( Now it looks like this:
Code: [Select]
if age_old == true
 then age_young = false
elsif age_old == false
 then age_young= true
end
#-----------------------------------------------------------------------------------------------------
#Excactly ten lines of comments here.
#-----------------------------------------------------------------------------------------------------
if age_old == true
  then p "I am an old idiot"
 elsif age_young == true
  if gen_girl == false
   then p "I am a young boy"
  elsif gen_girl == true
      then p "I am a young girl"
 end
end

Also, would it be easier to have one variable to define age? So I have age_old instead of also "age_young? Ah heck, I'll try it. Might work miracles...
« Last Edit: January 08, 2008, 07:19:34 PM by Demonic Blade »
I wonder how many of my-reps are there for a reason, and not just because some jackass wanted to show off in front of some other jackasses...?
Probably a lot of them - and those people sure as hell don't deserve my pity, let alone my disgust.
That's right, let's see some more -Rep'ing! BOOYEAH!!

*
A Random Custom Title
Rep:
Level 96
wah
Last I checked, you don't use "then" in a conditional. If you have too many "end"s, the game checks all scripts to see if they're correct in syntax. Then when you run it, it runs and sees if it works. Fix it. Use good scripting spacing. White space is your friend.

*
Rep:
Level 97
2014 Most Unsung Member2014 Best RPG Maker User - Engine2013 Best RPG Maker User (Scripting)2012 Best Member2012 Best RPG Maker User (Scripting)2012 Favorite Staff Member2012 Most Mature MemberSecret Santa 2012 ParticipantProject of the Month winner for July 20092011 Best Veteran2011 Favourite Staff Member2011 Most Mature Member2011 Best RPG Maker User (Scripting)2011 Best Use of Avatar and Signature Space2010 Most Mature Member2010 Favourite Staff Member
Well, if it is an error at line 26, why only post the first ten lines?  :police:

Also, you are correct that it is redundant to have two boolean variables for age as there are only two positions. Also, the 'then' are redundant, but they also do not hurt as far as I know. The then is really only necessary if you put it on the same line as the if statement.

Also, as moo says, you do not need to run the script for the player to recognize syntax errors.

In any case, please post the entire script.

*
A Random Custom Title
Rep:
Level 96
wah
Also, an "end" works for the most recent thing that can be ended. Like...

Class Poop

 def pooper
 *stuff*

end.

Although this lines up with Class Poop, it works with def pooper. There really isn't such a thing as "removing the wrong end." Also, post up the whole script, like MA says, and we could probably re-do the error and fix it for you.

P.S.: If he does post up the whole script, can I have a whack at solving it before you guys do? Or at least try before you post it up so I don't cheat. XD Like a one day grace period after I notice it, lol.
« Last Edit: January 08, 2008, 10:04:17 PM by mastermoo420 »

***
Rep:
Level 86
I hate everyone except the ones I don't hate...
I did post the whole thing... Oh, and I haven't tried calling the full script, I only put it in the script editor. As I said, there are 12 lines of comments. The "There's about 10 comments here" is actually 12 lines... ::).
I wonder how many of my-reps are there for a reason, and not just because some jackass wanted to show off in front of some other jackasses...?
Probably a lot of them - and those people sure as hell don't deserve my pity, let alone my disgust.
That's right, let's see some more -Rep'ing! BOOYEAH!!

*
A Random Custom Title
Rep:
Level 96
wah
Soo....
Code: [Select]
if age_old == true
 age_young = false
 elsif age_old == false
  age_young= true
end
end
# Theres about 10 lines of comments here XD...
if age_old == true
  then p "I am an old idiot"
 elsif age_young == true
  if gen_girl == false
   then p "I am a young boy"
  elsif gen_girl == true
      then p "I am a young girl"
   end
 end
end

Spoiler for Before 10 lines of comment:
Your first conditional branch before the comments could probably be turned into:
Code: [Select]
if @age_old == true
 @age_young = false
else
 @age_young= true
end
Since there's nothing other than age_young and age_old. Also, try adding an @ like I did so that accessibility is not an issue (just in case :P).

Spoiler for After 10 lines of comment:
Code: [Select]
if @age_old == true
 p "I am an old idiot"
 elsif @age_young == true
  if @gen_girl == false
   p "I am a young boy"
   elsif @gen_girl == true
    p "I am a young girl"
   end
  end
 end
end
You missed an "end" and I changed it to have @variables.
Maybe try this? :P

********
Hungry
Rep:
Level 96
Mawbeast
2013 Best ArtistParticipant - GIAW 11Secret Santa 2013 ParticipantFor the great victory in the Breakfast War.2012 Best Game Creator (Non-RM Programs)~Bronze - GIAW 9Project of the Month winner for December 2009Project of the Month winner for August 20082011 Best Game Creator (Non RM)Gold - GIAW Halloween
umm
wouldn't this would be -much- easier to handle with event processing?

that aside
this can be done with scripts, but I think you're interpreting the way the script system works incorrectly
the scripts aren't compiled and run constantly, there is no call for all those conditionals you made
meaning that regardless of if you have proper syntax, it'll never be executed
you'd need to make a class, and at least a method to call all those ifs
not only that but the booleans should be class specific (seeing as you don't want to use event accessed variables) and you'd need to change them with the following syntax

Code: [Select]
$class_name.boolean_name = false

have you seen blizzard's scripting tutorial?
« Last Edit: January 09, 2008, 09:23:42 PM by NAMKCOR »

FCF3a A+ C- D H- M P+ R T W- Z- Sf RLCT a cmn+++ d++ e++ f h+++ iw+++ j+ p sf+
Follow my project: MBlok | Find me on: Bandcamp | Twitter | Patreon

***
Rep:
Level 86
I hate everyone except the ones I don't hate...
No, I only read constance's (RPG's)... And as I said, this was mainly just for fun, but I wanted to try it out. AND I don't understand the class thing, I'm not even sure he mentioned that in the script. But I'll try out blizz's scripting tut then... later...
I wonder how many of my-reps are there for a reason, and not just because some jackass wanted to show off in front of some other jackasses...?
Probably a lot of them - and those people sure as hell don't deserve my pity, let alone my disgust.
That's right, let's see some more -Rep'ing! BOOYEAH!!

*
A Random Custom Title
Rep:
Level 96
wah
Holy crap, Blizz finished his scripting tutorial?

********
Hungry
Rep:
Level 96
Mawbeast
2013 Best ArtistParticipant - GIAW 11Secret Santa 2013 ParticipantFor the great victory in the Breakfast War.2012 Best Game Creator (Non-RM Programs)~Bronze - GIAW 9Project of the Month winner for December 2009Project of the Month winner for August 20082011 Best Game Creator (Non RM)Gold - GIAW Halloween
idk if it's done but there's a good amount of it from what I saw

No, I only read constance's (RPG's)... And as I said, this was mainly just for fun, but I wanted to try it out. AND I don't understand the class thing, I'm not even sure he mentioned that in the script. But I'll try out blizz's scripting tut then... later...

you need to understand classes and defs or you will never be able to script
simple fact k?

FCF3a A+ C- D H- M P+ R T W- Z- Sf RLCT a cmn+++ d++ e++ f h+++ iw+++ j+ p sf+
Follow my project: MBlok | Find me on: Bandcamp | Twitter | Patreon

***
Rep:
Level 86
I hate everyone except the ones I don't hate...
Okay, okay. No need to get mean (which u aren't, but I had to say something right?). But let's face it. It took me a couple of days to read it, and by that time I had forgotten most of the first things. "You should read it again then" you'll say, but I don't want to right now, 'cuz I don't have that much time! Besides, we've got a bunch of homework since we're doing a musical in school at the moment, and so we have no normal classes. Oh, and Mastermoo, I have no idea. I've never heard of it anyhow...
I wonder how many of my-reps are there for a reason, and not just because some jackass wanted to show off in front of some other jackasses...?
Probably a lot of them - and those people sure as hell don't deserve my pity, let alone my disgust.
That's right, let's see some more -Rep'ing! BOOYEAH!!