Author Topic: ACTION_READLN and usage in a macro...  (Read 1851 times)

Offline cmorgan

  • Planewalker
  • *****
  • Posts: 1424
  • Gender: Male
  • Searcher of Bugs
ACTION_READLN and usage in a macro...
« on: November 04, 2010, 08:21:58 PM »
If I wanted to make the ACTION_READLN in this ( it is the same A_R ) a callable macro, what should I really use?



Code: [Select]
BEGIN  ~Aran Whitehand, Thief Dual-Class stats configuration (Spy)~
  FORCED_SUBCOMPONENT ~Choose Which Aran Configuration to install...~  
  REQUIRE_COMPONENT ~setup-testarea.tp2~ ~0~ ~Aran Whitehand must be installed for this to work.~
 
  PRINT ~Please choose from the following choices to modify starting armor and weapons available to him:
[1] Aran is down-and-out poor and has sold off most of his good equipment.
[2] Aran has kept most of his good gear.
[3] Aran has kept the best gear available to a successful mercenary.~
OUTER_SPRINT ~aran_wealth~ ~placeholder_value~
OUTER_WHILE (!(IS_AN_INT ~aran_wealth~) OR (~aran_wealth~ > 0x4) OR (~aran_wealth~ < 0x1)) BEGIN
PRINT ~Please select 1, 2, or 3 and press enter.~
ACTION_READLN ~aran_wealth~
END

COPY ~aranw/cre/c-arnthf.cre~ ~override/c-aran7.cre~
   PATCH_IF (SOURCE_SIZE > 0x2d3) THEN BEGIN
        LAUNCH_PATCH_MACRO ~aran_cre_setup~
   END
BUT_ONLY_IF_IT_CHANGES

I was hoping to have a few small easy LAUNCH_PATCH_MACRO ~aran_ask_wealth~, etc.

guest

  • Guest
Re: ACTION_READLN and usage in a macro...
« Reply #1 on: November 04, 2010, 09:35:30 PM »
Code: [Select]
DEFINE_ACTION_MACRO aran_wealth_selection BEGIN
  OUTER_FOR( aran_wealth = 0 ; ~%aran_wealth%~ STRING_COMPARE_REGEXP ~^[123]$~ ; )BEGIN
    PRINT ~Please choose from the following choices to modify starting armor and weapons available to him:
[1] Aran is down-and-out poor and has sold off most of his good equipment.
[2] Aran has kept most of his good gear.
[3] Aran has kept the best gear available to a successful mercenary.

Please select 1, 2, or 3 and press enter.~
    ACTION_READLN aran_wealth
  END
END
Code: [Select]
BEGIN  ~Aran Whitehand, Thief Dual-Class stats configuration (Spy)~
  FORCED_SUBCOMPONENT ~Choose Which Aran Configuration to install...~  
  REQUIRE_COMPONENT ~setup-testarea.tp2~ ~0~ ~Aran Whitehand must be installed for this to work.~

  LAM aran_wealth_selection
  
  COPY ~aranw/cre/c-arnthf.cre~ ~override/c-aran7.cre~
    LPM aran_cre_setup
  BUT_ONLY

?

the macro isn't doing any real work in this, though - is there something in particular you want it to accomplish?

Offline cmorgan

  • Planewalker
  • *****
  • Posts: 1424
  • Gender: Male
  • Searcher of Bugs
Re: ACTION_READLN and usage in a macro...
« Reply #2 on: November 05, 2010, 10:15:06 AM »
Yep - setting player-chosen  vars to allow a single patch  pass at the .cre, modifying it according to their choice. Sort of a poor-coder's copy-paste-destroy homage to Level1NPCs. All the macro is set up to do is set vars.  ( http://forums.gibberlings3.net/index.php?s=&showtopic=21244&view=findpost&p=176511 )

 the regexp ~^[123]$~  ... ^ = first character, then the set of three characters that are valid (we want to find), and the first character is also the last character (the $).  right?

Off to test this out, thanks -

 

With Quick-Reply you can write a post when viewing a topic without loading a new page. You can still use bulletin board code and smileys as you would in a normal post.

Warning: this topic has not been posted in for at least 120 days.
Unless you're sure you want to reply, please consider starting a new topic.

Name: Email:
Verification:
Type the letters shown in the picture
Listen to the letters / Request another image
Type the letters shown in the picture:
What color is grass?:
What is the seventh word in this sentence?:
What is five minus two (use the full word)?: