Author Topic: scripting suggestians / shortcuts  (Read 594 times)

Offline nathmatt

  • Chaos User
  • ******
  • Posts: 1289
  • LV: 114
  • Gender: Male
  • The Add_on King
    • View Profile
    • Nathmatt Productions
scripting suggestians / shortcuts
« on: May 30, 2010, 11:45:41 PM »
i made a class of script calls with things like chapter save inn messages random npc messages just thought i also combined this with a AMS i made to go with it just some scripting ideas

edit: what I meant was to give ppl a suggestion to create a class for everything they use a lot i may mess around with it some and post it up with a small tutorial on how to add to it

edit:  OK here is what i have

calls
(click to show/hide)

AMS
(click to show/hide)

now y i did not post this under scripts because i figure you wont use this as is im got to help you add to it for ur own game for it purposes

so first off if you notice the inn in the script calls
Code: [Select]
def Inn(name,gold)
    $game_temp.choice_start += 1
    return "\\Name[Inn Keeper]Would you Like to stay at the \\c[2]#{name}\\c[0]" +
    "\n for \\c[6]#{gold}\\c[0] \\gold."
 end
If your using msg calls you have to add \\ instead of \ for it to read it also using #{variable} will allow you to add that variable to your msg as long as you use the double quotations ("") and if you are using the choice selector in your msg the for every line after the first 1 you need to add 1 to $game_temp.choice_start OK that is a bit about how to use a msg call now how i added it to the msg script
Code: [Select]
text.gsub!(/\\[Ii]nn\[([\S, ]+)\]/) {
        data = $1.split(',')
        $calls.Inn(data[0],data[1]) }
the text.gsub!(/\\[Ii]nn\[([\S, ]+)\]/) is used to find either \Inn or \inn then in the brackets we have \S, that tells it i want to get anything but spaces in the bracket the comma tells it i want an array size of 2 the $1.split(',') i used store the $1 array into data then i called my script call from my Calls class $calls.Inn(data[0],data[1])  i store the inns name in data[0] and the price in data[1] by using \inn[name,price] now to add your own just define something in the Calls class then have it call it that way but change the [Ii]nn if its an array if not use can use this to call 1 with one variable or none
Code: [Select]
text.gsub!(/\\[Mm]/) do
        $calls.Map_Name
      end
as you can see we used text.gsub!(/\\[Mm]/) do $calls.Map_Name this tells it when \M or \M call $calls.Map_Name which i store the maps name in in my Calls class
text.gsub!(/\\[Rr]\[(\S+)\]/) do $calls.random_message($1) stores one variable and calls $calls.random_message($1) same as above

if you need any help addind any thing else or want something added to whats already here post


« Last Edit: May 31, 2010, 03:23:09 AM by nathmatt »
Join Dead Frontier
Sorry, I will no longer be scripting for RMXP. I may or may not give support for my scripts. I don't have the will to script in RGSS anymore.
My script
(click to show/hide)