Chaos Project

RPG Maker => RPG Maker Scripts => Script Requests => Topic started by: diagostimo on June 05, 2012, 08:41:17 pm

Title: script call for button input?
Post by: diagostimo on June 05, 2012, 08:41:17 pm
hey guys, i was wondering if there is a script call that checks if any input button is pressed? mainly for use in a conditional branch so if the player moves or anything then the condition can run.
Title: Re: script call for button input?
Post by: ThallionDarkshine on June 05, 2012, 09:02:30 pm

Input.press?
Input.trigger?
Title: Re: script call for button input?
Post by: LiTTleDRAgo on June 05, 2012, 09:15:39 pm
Quote from: diagostimo on June 05, 2012, 08:41:17 pmmainly for use in a conditional branch so if the player moves or anything then the condition can run.


QuoteConditional Branch : $game_player.moving?
@>
@>
End


or

QuoteConditional Branch : Input.dir8 != 0
@>
@>
End

Title: Re: script call for button input?
Post by: diagostimo on June 05, 2012, 10:22:25 pm
cool thanks guys, also off topic but im trying to change my actors graphic via script  and it will change when a switch is activated, heres what i have at the moment:
class Game_Map
  if $game_switches == (0 == true)
    actor = $game_actors[0]
    actor.set_graphic("aluxeswc.png", 255)
    $game_player.refresh
  end
end

i got my code from reading the interpreters and seeing how the events did it but i havnt had any look so far :(
Title: Re: script call for button input?
Post by: ForeverZer0 on June 05, 2012, 10:31:54 pm
Not sure what "game_switches = (0 == true)" is supposed to do, you didn't find that in the Interpreter.
0 will never equal true, and $game_switches will never equal false. Game_Switches is a wrapper for an array that simply holds a bunch of true/false values.

This is probably something like what you want to do:
class Interpreter
 
 def my_call
   if $game_switches[ID_OF_SWITCH]
     a = $game_actors[ID_OF_ACTOR]
     a.set_graphic('aluxeswc', a.character_hue, a.battler_name, a.battler_hue)
   end
 end
end


You simply replace the values in all caps with what you want, and call "my_call" in a script call.

EDIT:
On another note, a value of 0 for index of $game_actor will throw an error. In pretty much all the data classes, the first element is always nil.
Title: Re: script call for button input?
Post by: diagostimo on June 05, 2012, 11:34:09 pm
hm i tried messing with that example but no luck, im calling the it with this script call: $my_call

also do i need the $game_player.refresh? im not getting any errors its just not doing anything :/

class Newclass
 
 def my_call
   if $game_switches[0]
     a = $game_actors[nil]
     a.set_graphic('aluxeswc.png', 0, nil, 0)
     $game_player.refresh
   end
 end
end
Title: Re: script call for button input?
Post by: ForeverZer0 on June 05, 2012, 11:47:19 pm
You just modified every bit of code I posted as an example to something totally different, the majority of which will cause errors, and somehow expect it to work?



Paste the script I posted in a new slot. Change the actor id to 1, change the switch id to 1. Make a script call with the event command that simply reads "my_call". Nothing else. No $ symbols. No @ symbols. Just that.
Title: Re: script call for button input?
Post by: diagostimo on June 06, 2012, 07:56:37 am
cool i got it to work, im still getting used to how all the functions work but im slowly getting there, iv also been trying to change the actors step_anime to true, what im trying to build here is a script that changes the graphic, sets it so the character is animated then switches back, heres what i came up with to turn step_anime on:
class Game_Character
  alias new_update update
  def update
    new_update
    if game_switches[1]
      @actor_step_anime = true
    end
  end
end

the problem here is every event is set to this also