Chaos Project

RPG Maker => General Discussion => Troubleshooting / Help => Topic started by: Jereth on January 04, 2016, 04:41:55 am

Title: Event Scripting Window
Post by: Jereth on January 04, 2016, 04:41:55 am
This has been driving me nuts for about 3 months and I've googled the crap out of it. I'm not sure if this is a Windows 7 issue or just a thing now. I'm running RPGXP 1.05a and for some reason the scripting window that pops up in the events database has a hard limit of 37 characters per line before it carriage returns. I have tried:

What I've had to do is modify main scripts to shorten the lines I use in event scripts.
Searching google and forums has produced no results so I'd figure I'd ask while I had this forum open.
Title: Re: Event Scripting Window
Post by: Zexion on January 04, 2016, 09:21:51 am
Sadly, this works as intended. If you need to use script calls that are really long, you have to break it up.
This:
$game_party.actors[0].hp += $game_variables[23]

Won't fit and will cause an error even though it is proper code. To get around it you break it up:
actor = $game_party.actors[0]
var = $game_variables[23]
actor.hp += var

It's honestly kind of annoying, but it shouldn't be a problem as long as you understand the syntax :3
Title: Re: Event Scripting Window
Post by: KK20 on January 04, 2016, 12:02:04 pm
For more commonly used script calls, you can make a module and create some methods to make the process easier to call.

module ScriptCall
  def self.add_player_hp(party_index, variable_id)
    $game_party.actors[party_index].hp += $game_variables[variable_id]
  end
end


EDIT: I also did post something (http://forum.chaos-project.com/index.php/topic,13370.msg177694.html#msg177694) on these forums that will keep reading the lines until it encounters a semi-colon. So you could have something like

$game_party.
actors[0].hp
+= $game_variables
[23];
print "It works!"
Title: Re: Event Scripting Window
Post by: Jereth on January 04, 2016, 06:52:53 pm
Sadly, I expected it to be as intended. I have been using a lot of shortening, mainly for text strings. The main reason I decided to ask about it was Easy Party Switcher by Blizzard. In his demo he has events scripts easily exceeding 37 characters. For example.
Spoiler: ShowHide
$game_actors[3].disabled_for_party = true
$game_actors[5].disabled_for_party = true
$game_actors[6].disabled_for_party = true
$game_actors[7].disabled_for_party = true
$game_actors[8].disabled_for_party = true

So either older versions supported it, there's a trick around it, the dialog menu was modified by a resource editor, or it was an older hacked version of RMXP. So if anyone knows how it's done, that would be a great piece of advice.
Title: Re: Event Scripting Window
Post by: KK20 on January 05, 2016, 03:17:35 am
Hmm, I'll check this out when I get home. I have my suspicions.

EDIT: The demo is running on 1.02a, which I have downloaded (along with 1.04). The editor is still the same. Not sure if computers were capable of decreasing font size or anything, but I can ensure you it was not a hacked editor nor modded in any way.

I know you can hard-code your events to be that way. This is pretty rushed and unfriendly code, but it gets the job done:

MAPID = 2
SCRIPT_CALL = "$game_actors[3].disabled_for_party = true
$game_actors[5].disabled_for_party = true
$game_actors[6].disabled_for_party = true
$game_actors[7].disabled_for_party = true
$game_actors[8].disabled_for_party = true"

begin
  map = load_data(sprintf("Data/Map%03d.rxdata", MAPID))
  i = 0
  SCRIPT_CALL.split("\n").each{|line|
    cmd = RPG::EventCommand.new((i == 0 ? 355 : 655), 0, [line])
    map.events[1].pages[0].list[i] = cmd
    i+=1
  }
  map.events[1].pages[0].list[i] = RPG::EventCommand.new
  file = File.open(sprintf("Data/Map%03d.rxdata", MAPID), "wb")
  Marshal.dump(map, file)
  file.close
  p "Successfully created. Please close and re-open game to get your script call. DO NOT SAVE!"
  exit
end

This will modify the first event (i.e. EV001) on the MAPID of your choosing. In the example above, I created a blank second map with one event in it. Put in your script call string, making sure you have double quotes at the start and end. Place this script anywhere above Main in your project. Run the project and a message window should pop up. Close and reopen the game and look at your event.

Now you can copy and paste that script call into any event you want. Just be sure to not edit it.
Title: Re: Event Scripting Window
Post by: Jereth on January 05, 2016, 09:13:22 am
Quote from: KK20 on January 05, 2016, 03:17:35 am
This will modify the first event (i.e. EV001) on the MAPID of your choosing. In the example above, I created a blank second map with one event in it. Put in your script call string, making sure you have double quotes at the start and end. Place this script anywhere above Main in your project. Run the project and a message window should pop up. Close and reopen the game and look at your event.


That was just an example of 38+ character usage I know of, I had already dealt with the problem with that with an alias, but thanks for taking the time to type out a solution ;)