help with a small time script

hello fellow rpg creators. i need some help with something... i have a script that i've been working on and i think that it runs but nothing happens when it needs to run. so i'm asking for help with debugging the mess i've made.

the script basically is a life counter script (like mario,)

def death(died)
@died = $game_party.all_dead?
if death
for i in (SceneManager.goto(Scene_Map))
return i
end
end

the above script is part of the script i'm working on but it's the part thats confusing me the most because this part is the part that is supposed to check if the party is dead and if they are dead bring the party back to the map.
for i in (SceneManager.goto(Scene_Map))
What do you expect to happen in this specific line of code?
def death(died)
@died = $game_party.all_dead?
if death

And in these lines of code. You have a method name and are passing in an argument. Then you are setting a different variable that is not the same as the argument, then you are using the same function name in the if statement.
What do you expect to happen in this specific line of code?

i wanted this to bring the player back to the map if the player was to die in a battle. i understand i can use an event script for this but i feel like i have more control over the process in the scripting area
And in these lines of code. You have a method name and are passing in an argument. Then you are setting a different variable that is not the same as the argument, then you are using the same function name in the if statement.

so what your telling me is this is just a bunch of garbage that needs to get thrown away.

is there anyway i can fix the syntax so this code would run?
What are you actually trying to accomplish with this?
@xana_the_machine
your code shows that you probably have very little experience in programming, exactly because what you gave us is mostly nonsense.

and that is a big problem in this situation:
while it is possible to do what you describe, it will need to be done completely different, and with a lot more knowledge about programming that you seem to have.
and you didn't even give enough info to understand the framework inside which to work what you want.

So we can't tell you how to do this without getting a much better description of your entire script and its purpose.
Andar's very valid point aside, kudos to you for trying to make something yourself. It's just a shame your scripting knowledge isn't quite up to the task yet, but with some work, research and a helping hand you can get there.
@xana_the_machine
your code shows that you probably have very little experience in programming, exactly because what you gave us is mostly nonsense.

and that is a big problem in this situation:
while it is possible to do what you describe, it will need to be done completely different, and with a lot more knowledge about programming that you seem to have.
and you didn't even give enough info to understand the framework inside which to work what you want.

So we can't tell you how to do this without getting a much better description of your entire script and its purpose.


thanks man

class Death_Count < Scene_Gameover


def death(died)
@died = $game_party.all_dead?
if death

end


end


def extra_life(lives, max_lives)
@lives = 2
@max_lives = $Game_Party.all_members
end

def revive()
@revive = Scenemanager.goto(Scene_Map)
if death
end

end

end


this is my entire code that i have been working on.

yes my experience with coding is limited and i need some help...

this is what i've learned from sololearn and code acadamy while doing my own research on YT....
Andar's very valid point aside, kudos to you for trying to make something yourself. It's just a shame your scripting knowledge isn't quite up to the task yet, but with some work, research and a helping hand you can get there.

hopefully i'm in the right place for the helping hand to point me in the right direction
What are you actually trying to accomplish with this?

i wanted to make a life counter... but the code that i showed was only a small part.... that i changed last night due to uncertainty with my own understanding of ruby
this is what i've learned from sololearn and code acadamy while doing my own research on YT....
and unfrotunately that way you missed several important points, which is why that doesn't work.

Most basic tutorials and academies start by teaching you how to write your own programs in simple steps. That includes one simplification that will never work in this case:
If you write a program yourself, you are the one who sets where it starts.
But the RM-engine is not your program, it is started without you.
Which means the first step is finding points where to change it instead of writing code that is completely unconnected.

there is no code "death" anywhere in the game, so that function you wrote will never be called.
instead you need to read the engine code until you find the place where it determines that the player died, and use the function names that are given there to get the engine redirected from that point to your function.

That is called "aliasing" a function and is still several long steps ahead of your knowledge.

additionally, you have misinterpreted code you read without understanding it. For example
@revive = Scenemanager.goto(Scene_Map)
this would set a variable @revive with the return value of the function scenemanager.goto(scene_map);
but as far as I know that function has no return value and even if it has, you do nothing with the value you receive.
And the way you use it makes me think you read it literally "at revive do this...", but that is completely misreading things, especially because @ in programming has nothing to do with the game loop or timing.

at this moment you have two options:
1) go back to code academy and work through their tutorials until the course is complete. That will probably take several months, because no one has learned their first programming language faster than that. Only after you got the basics of programming you can learn new languages faster, but not for your first language.
This will have the advantage that you'll be able to do a lot, and not only for your game - programming knowledge helps in a lot of areas including school and work, for example when using Excel or similar programs for more than adding numbers.

2) make a description of what exactly you want and make a script request to let someone else make that script, then check it how it differs from what you thought how programming looks.
yes my experience with coding is limited and i need some help...
Depends on what you're trying to achieve.
- If you're aiming to get the life counter script working, I suggest just request someone to make it.
- If you're aiming to learn RGSS3, then I suggest making a simpler system.

Life/Death counter script can get complex beyond your understanding in your current state.
For starters, you can try to modify the existing system (like moving the window position) instead of making something new like life/death counter script.
and unfrotunately that way you missed several important points, which is why that doesn't work.

Most basic tutorials and academies start by teaching you how to write your own programs in simple steps. That includes one simplification that will never work in this case:
If you write a program yourself, you are the one who sets where it starts.
But the RM-engine is not your program, it is started without you.
Which means the first step is finding points where to change it instead of writing code that is completely unconnected.

there is no code "death" anywhere in the game, so that function you wrote will never be called.
instead you need to read the engine code until you find the place where it determines that the player died, and use the function names that are given there to get the engine redirected from that point to your function.

That is called "aliasing" a function and is still several long steps ahead of your knowledge.

additionally, you have misinterpreted code you read without understanding it. For example

this would set a variable @revive with the return value of the function scenemanager.goto(scene_map);
but as far as I know that function has no return value and even if it has, you do nothing with the value you receive.
And the way you use it makes me think you read it literally "at revive do this...", but that is completely misreading things, especially because @ in programming has nothing to do with the game loop or timing.

at this moment you have two options:
1) go back to code academy and work through their tutorials until the course is complete. That will probably take several months, because no one has learned their first programming language faster than that. Only after you got the basics of programming you can learn new languages faster, but not for your first language.
This will have the advantage that you'll be able to do a lot, and not only for your game - programming knowledge helps in a lot of areas including school and work, for example when using Excel or similar programs for more than adding numbers.

i don't under2) make a description of what exactly you want and make a script request to let someone else make that script, then check it how it differs from what you thought how programming looks

and unfrotunately that way you missed several important points, which is why that doesn't work.

Most basic tutorials and academies start by teaching you how to write your own programs in simple steps. That includes one simplification that will never work in this case:
If you write a program yourself, you are the one who sets where it starts.
But the RM-engine is not your program, it is started without you.
Which means the first step is finding points where to change it instead of writing code that is completely unconnected.

there is no code "death" anywhere in the game, so that function you wrote will never be called.
instead you need to read the engine code until you find the place where it determines that the player died, and use the function names that are given there to get the engine redirected from that point to your function.

That is called "aliasing" a function and is still several long steps ahead of your knowledge.

additionally, you have misinterpreted code you read without understanding it. For example

this would set a variable @revive with the return value of the function scenemanager.goto(scene_map);
but as far as I know that function has no return value and even if it has, you do nothing with the value you receive.
And the way you use it makes me think you read it literally "at revive do this...", but that is completely misreading things, especially because @ in programming has nothing to do with the game loop or timing.

at this moment you have two options:
1) go back to code academy and work through their tutorials until the course is complete. That will probably take several months, because no one has learned their first programming language faster than that. Only after you got the basics of programming you can learn new languages faster, but not for your first language.
This will have the advantage that you'll be able to do a lot, and not only for your game - programming knowledge helps in a lot of areas including school and work, for example when using Excel or similar programs for more than adding numbers.

2) make a description of what exactly you want and make a script request to let someone else make that script, then check it how it differs from what you thought how programming looks.
ok man will do thanks for looking at least
When you say you're trying to make a life counter, what exactly will said counter do? What lives is it tracking?
When you say you're trying to make a life counter, what exactly will said counter do? What lives is it tracking?
ok (i'm going to assume that you've played ff6, megaman, mario and pokemon) it'll track how many times you've died, how many lives you have, how many party members you have alive and how many lives they have, how many party members have died, how many times the party members have died and which party members have died...

i'm sure it's a bunch of small calls and aliases and reiterations... but my coding skills are weak and i need a index of ruby's syntaxes (basically i need a dictionary or a PDF file that has all or most of the methods that are in ruby...)
Have you looked at my Slip into Ruby series?
Have you looked at my Slip into Ruby series?
i have not..... but i will. thanks

Original thread: https://forums.rpgmakerweb.com/threads/help-with-a-small-time-script.132785/