Wanting to make a series of conditionals. Got an error.

menea6587

Villager
Member
Joined
Feb 11, 2014
Messages
26
Reaction score
1
First Language
English
Primarily Uses
I want to make the system differentiate between buffs and debuffs so that I'm not stuck with -X*buffcount% and +X*buffcount%. I decided to use the object param_id as the case identifier. Here is my code:

def param_buff_rate(param_id) if param_id < 0 @buffs[param_id] * 0.15 + 1.0 if param_id > 0 @buffs[param_id] * 0.5 + 1.0 if param_id == 0 @buffs[param_id] * 0 + 1.0 endSince the error message pointed to line 738 as an unexpected "end," I'm guessing my syntax is off instead of referencing the wrong object/function. I am a complete newb at RGSSx, so bear that in mind with any details given.
 

mjshi

Jack of Most Trades
Veteran
Joined
Feb 16, 2013
Messages
969
Reaction score
807
First Language
English
Primarily Uses
N/A
You're missing a couple of ends.

def param_buff_rate(param_id) if param_id < 0 @buffs[param_id] * 0.15 + 1.0 end if param_id > 0 @buffs[param_id] * 0.5 + 1.0 end if param_id == 0 @buffs[param_id] * 0 + 1.0 end endAt the end of every conditional, you need to have an end.Another way you could do this is

Code:
 def param_buff_rate(param_id)    if param_id < 0      @buffs[param_id] * 0.15 + 1.0     elsif param_id > 0      @buffs[param_id] * 0.5 + 1.0     elsif param_id == 0      @buffs[param_id] * 0 + 1.0     end  end
 
Last edited by a moderator:

menea6587

Villager
Member
Joined
Feb 11, 2014
Messages
26
Reaction score
1
First Language
English
Primarily Uses
okie dokie, thanks
 

Ramiro

Now with an army of Mecha-Ralphs!
Veteran
Joined
Aug 5, 2015
Messages
858
Reaction score
364
First Language
Spanish
Your problem is actually just many syntax errors together:

Your coude should look like this:

  1. def param_buff_rate(param_id) if param_id < 0 @buffs[param_id] * 0.15 + 1.0 elsif param_id > 0 @buffs[param_id] * 0.5 + 1.0 else # param_id == 0 ... @buffs[param_id] * 0 + 1.0 endend I don't know why you try to write code like that, are you from phyton ?
  2. See the else and the elsif, wich is a combination of else and if ?
  3. Also you missed many ends there...

I just ask something too, this line:

@buffs[param_id] * 0 + 1.0Why *0 + 1, just return 1...

@edit ninja'ed again
 
Last edited by a moderator:

Engr. Adiktuzmiko

Chemical Engineer, Game Developer, Using BlinkBoy'
Veteran
Joined
May 15, 2012
Messages
14,682
Reaction score
3,003
First Language
Tagalog
Primarily Uses
RMVXA
If youre checking the samw thing, just use cases...
 

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

Latest Threads

Latest Posts

Latest Profile Posts

Just beat the last of us 2 last night and starting jedi: fallen order right now, both use unreal engine & when I say i knew 80% of jedi's buttons right away because they were the same buttons as TLOU2 its ridiculous, even the same narrow hallway crawl and barely-made-it jump they do. Unreal Engine is just big budget RPG Maker the way they make games nearly identical at its core lol.
Can someone recommend some fun story-heavy RPGs to me? Coming up with good gameplay is a nightmare! I was thinking of making some gameplay platforming-based, but that doesn't work well in RPG form*. I also was thinking of removing battles, but that would be too much like OneShot. I don't even know how to make good puzzles!
one bad plugin combo later and one of my followers is moonwalking off the screen on his own... I didn't even more yet on the new map lol.
time for a new avatar :)

Forum statistics

Threads
106,018
Messages
1,018,357
Members
137,803
Latest member
andrewcole
Top