Jump to content

Recommended Posts

I am currently going through a huge conversion in a game project replacing virtually all the "alike" variables into indexed arrays.

 

Problem is, when I do a 'search and replace', it isn't looking for exclusive variable names, rather--any portion of any string that has the letter combination gets "found" and I have to toggle through 20-30 non-variable string portions in order to find the 4-5 actual variable references for changing.

 

For instance... If I want to replace MHP with HP(3,2), I have to cycle through all references to MMHP,BMHP,SMHP, etc while looking for the sovereign "MHP" variable.

 

Is there an option in Find and Replace that will narrow down the search to ONLY find or replace the variable MHP with HP(3,2)?

 

Would using quotation marks around the search object do it, or is there a box I can click or something?

 

I have about 40 variables to replace with arrays, so just doing ONE set of (4,2) took about 15 minutes last night.

 

I am away from my computer right now, but I will be returning to the conversion tonight.

 

Any help would be appreciated. :)

Edited by Opry99er
Link to comment
https://forums.atariage.com/topic/237897-ot-notepad-tips/
Share on other sites

The problem with text editors is that they only know text. This is where an IDE with intellisense really shines because the editor is parsing the code and understands the difference between what is a variable vs. a string, vs. a comment, etc. Such editors let you do something call "refactor" a variable, i.e. change its name (or its type) easily and correctly. Syntax highlighting is a crude form of intellisense but it does not have the power to do things like refactoring of variables or functions.

 

Sadly I do not know of any intellisense editors for BASIC (any BASIC), let alone our specific dialect. In these cases I use the "replace - next" feature that most editors have. Replace-next will replace the current match, then find the next match, all with a single click. This lets you put your eyes on each match quickly and decide if you want to replace it or skip it.

Link to comment
https://forums.atariage.com/topic/237897-ot-notepad-tips/#findComment-3230934
Share on other sites

...Sadly I do not know of any intellisense editors for BASIC (any BASIC), let alone our specific dialect. In these cases I use the "replace - next" feature that most editors have. Replace-next will replace the current match, then find the next match, all with a single click. This lets you put your eyes on each match quickly and decide if you want to replace it or skip it.

FreeBASIC + Geany appears to have some capabilities; I'm pretty sure I saw Geany recognizing variables, but I'm not positive, I've only been playing with FreeBASIC for a couple days now. I also just got FreeBASIC syntax highlighting to work in Pluma, but now that you mention it I should write a .lang file for our dialect :D.

Link to comment
https://forums.atariage.com/topic/237897-ot-notepad-tips/#findComment-3231013
Share on other sites

Use regular expressions for search and replace.

 

It can be a bit tricky to learn, since pattern matching is far more complicated / capable than using * and ?, but you can do replacements in an automated fashion.

 

On Windows, get this tool: http://rad-software-regular-expression-designer.software.informer.com/1.4/

Link to comment
https://forums.atariage.com/topic/237897-ot-notepad-tips/#findComment-3231096
Share on other sites

I was able to complete the conversion last night.

 

I thought the leading space would do the trick, but it did not, as there were lines in there like

 

AHP=MHP

 

That was missed in the search.

 

I did find the "whole word only" box, which I cannot believe I.missed the other night. :) That did the trick.

 

Once my multi-dimensional arrays were completed, the one dimensional arrays went fast. Took about 50 minutes last night to completely transition the variables.

 

Took another 20 or so minutes to debug the INPUT routines from disk. All is well. Thanks guys... For your help.

  • Like 3
Link to comment
https://forums.atariage.com/topic/237897-ot-notepad-tips/#findComment-3231238
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...