[RESOLVED] short code to check event comments in the first line

Started by Ryex, July 04, 2008, 02:04:23 pm

Previous topic - Next topic

Ryex

I need a short code that I can call with a Call script command and checks events in a line forward from the actor for a comment in the first line. and if that comment is the string your checking for it flips a self switch in that event to what you choose

you would call it like this

PLACE_CALL_SCRIPT_COMMAND_HERE('string checking for', #range to check, self switch setting to)

make sense?

I'm going to use this in a common event that is attached to a skill so when you use the skill on the map is activates events in range.
I no longer keep up with posts in the forum very well. If you have a question or comment, about my work, or in general I welcome PM's. if you make a post in one of my threads and I don't reply with in a day or two feel free to PM me and point it out to me.<br /><br />DropBox, the best free file syncing service there is.<br />

Blizzard

This is what I use to test if the first line is a comment.

module CP
 
  def self.first_comment(event, comment)
    return (event.list.is_a?(Array) && event.list[0].code == 108 &&
        event.list[0].parameters[0] == comment)
  end
 
end


I use first line only because checking every line in all events on the map can create a massive lag problem. This here is the alternative that checks ALL lines which I, of course, don't recommend :

module CP
 
  def self.event_comment(event, comment)
    return (event.list.is_a?(Array) &&
        event.list.any? {|c| c.code == 108 && c.parameters[0] == comment})
  end
 
end


You can call them like:

CP.first_comment($game_map.events[ID], 'COMMENT_HERE')

CP.event_comment($game_map.events[ID], 'COMMENT_HERE')


Of course you can rename the "module CP" to whatever you want. ;) That call with return either true or false depending on whether the first line is a comment and matches the 'COMMENT_HERE' string. You can then simply change the state of a self switch. Self switches are identified an array which contains their map ID, their event's ID and their own ID (0, 1, 2 and 3 for A, B, C and D respectively). I suggest using this call if you operate events on the current map:

key = [$game_map.map_id, EVENT_ID, OWN_ID]
$game_self_switches[key] = true


or similar depending on whether you turn them on or off.
Check out our game brands:

Daygames
Game Night Games
Chugnar Games

Quote from: winkioI do not speak to bricks, either as individuals or in wall form.

Quote from: Barney StinsonWhen I get sad, I stop being sad and be awesome instead. True story.

Phasedscar

I'm not exactly sure what the context of this is.  Are you talking about if an actor is facing an event and a condition is met the event's self switch will activate?
Spoiler: ShowHide
My own game project & My resource workshop! (respectively)
http://forum.chaos-project.com/index.php?topic=608.0 http://forum.chaos-project.com/index.php?topic=682.0



What that is? Affection area for flails. - Blizz-ABS, the ultimate ABS

The pictures in your signature may altogether be no more than 200kB. The height must not exceed 200 px and the width must not exceed 800 px. Altogether they may take up an area of 160000 px2. Every signature not matching this criteria is a subject of the moderator team to remove and leave this rule as message in your signature.

Ryex

sorry I was away for a week...

Ok thanks for your help now if I had a short code that checked the of event in a line facing the player

Diagram: ShowHide




In the diagram the player is in said square facing left, the red line is the range if the range was three it would check the events in three squares in fount of the player. but is would check them in order from the fount.

for example it would check events in square 1 first and if their was the right comment it returns the event id and not check any of the other events, if there isn't then it would check square 2 and so on to the max or the range.

make sense?
I no longer keep up with posts in the forum very well. If you have a question or comment, about my work, or in general I welcome PM's. if you make a post in one of my threads and I don't reply with in a day or two feel free to PM me and point it out to me.<br /><br />DropBox, the best free file syncing service there is.<br />

Ryex

sorry clicked quote instead of modify by accident and was too lazy to go back and try again

If the above can be done I can merge the two methods to what I need Thanks to every one who has helped so far.

I no longer keep up with posts in the forum very well. If you have a question or comment, about my work, or in general I welcome PM's. if you make a post in one of my threads and I don't reply with in a day or two feel free to PM me and point it out to me.<br /><br />DropBox, the best free file syncing service there is.<br />

Ryex

I no longer keep up with posts in the forum very well. If you have a question or comment, about my work, or in general I welcome PM's. if you make a post in one of my threads and I don't reply with in a day or two feel free to PM me and point it out to me.<br /><br />DropBox, the best free file syncing service there is.<br />