[Solved] Novice needs help: duplicate and alter a script

Discussion in 'RGSS3 Script Requests' started by Anthro7, Jan 31, 2019.

Thread Status:
Not open for further replies.
  1. Anthro7

    Anthro7 Villager Member

    Messages:
    15
    Likes Received:
    3
    First Language:
    English
    Primarily Uses:
    RMVXA
    Hi. I need help. Sorry. My coding skills are suck.

    So I've got Modern Algebra's quest journal script installed in the game I'm making ( ), and I like the way it works, so I want to use the same format for a second thing - a recipe book. When you open the menu from the game, it has added "Quests" to the options available there. Then further down in the script it lets you add information for individual quests. (You add them into your game and mark off when things are updated, completed, et al, via script calls. Sounds easy enough. I've gotten it to work on 11 quests so far with more to come.)

    But now I want to use the same format to create an additional menu option, "Recipe Book". Ideally, I'd use the same sorts of script calls in game events to add "recipes" to the "Recipe Book".

    Upon reaching a crafting table event, it would run a check to see if you've unlocked said recipe, if yes, allow crafting, if no, kickback. Or even easier, check character x's level, if => y, allow crafting, if no, kickback. (Because I'm planning that you unlock recipes by level reached. So it'll just run as a parallel in the background: if switch "character_x_level_2" is off, run check: if character x's level => 2, add recipe y, then turn switch "character_x_level_2" on. Or something like that.)

    The last paragraph really has no bearing on what I'm asking for, it's just explanation. What I'm asking for is a way to duplicate Modern Algebra's awesome script, but alter the terminology. So far, every time I try to go through and replace everything myself, I get some kind of stack overflow error. =( So we're back to: clearly I'm a novice game maker and suck at coding. I've done something wrong in thinking that copy/paste/alter-terms would do the trick. Anyone understand this stuff better who could explain to me what all I need to change to get this idea to work?

    Thanky. =(

    EDIT: D'X I'm sorry, I don't know how to make the pastebin link act like a link instead of an insert! I've tried changing the BBS code twice and nothing works!
     
    #1
  2. Roninator2

    Roninator2 Gamer Veteran

    Messages:
    1,741
    Likes Received:
    381
    Location:
    Canada
    First Language:
    English
    Primarily Uses:
    RMVXA
    This is because you...
    If I'm anywhere close to accurate..
    When the same code is used it will often give you a stack overflow. Also if you were to call a method inside the method.
    So you basically have this script in your game twice.

    In order for you to do what you want, you will have to find a different script that is similar in function
    Or, change almost all of MA Quest script to something else.
     
    #2
  3. Andar

    Andar Veteran Veteran

    Messages:
    28,643
    Likes Received:
    6,584
    Location:
    Germany
    First Language:
    German
    Primarily Uses:
    RMMV
    the problem here is that when duplicating a script, all it's function names are duplicated.
    and that will never work, each of the functions in the entire game needs to have their own, unique name.
    The same goes for any global variable defined in any script.

    so you'll either have to rewrite every single function and most variables in the script or use a different one.
     
    #3
  4. Anthro7

    Anthro7 Villager Member

    Messages:
    15
    Likes Received:
    3
    First Language:
    English
    Primarily Uses:
    RMVXA
    HEY! I got it to work! Yay! I so happeh!

    Following you guys' train of thought a little further down the track, I copied the whole script into Word and used the Replace command to swap "quest" (non case sensitive) to "recipe".

    Didn't work.

    Went through the thing line by line looking for possible problems.
    Changed the Menu Index from 4 to 5 for where it would draw it.

    Didn't work. (And after later testing, it turns out it simply bumps to 5 if they're to write to the same place.)

    Found a thing that said "maqj" and was like, "What the heck kind of command is- OH! Modern Algebra Quest Journal! Well, let's replace all instances of that and see if it works."

    [​IMG] Doo~doo~doo~doooooooooo!!!!!

    So thank you, guys! Case closed!
     
    #4
  5. slimmmeiske2

    slimmmeiske2 Little Red Riding Hood Moderator

    Messages:
    5,685
    Likes Received:
    4,162
    Location:
    Belgium
    First Language:
    Dutch
    Primarily Uses:
    RMXP

    This thread is being closed, due to being solved. If for some reason you would like this thread re-opened, please report this post and leave a message why. Thank you.

     
    #5
Thread Status:
Not open for further replies.

Share This Page