Gamestudio Links
Zorro Links
Newest Posts
AlpacaZorroPlugin v1.3.0 Released
by kzhao. 05/22/24 13:41
Free Live Data for Zorro with Paper Trading?
by AbrahamR. 05/18/24 13:28
Change chart colours
by 7th_zorro. 05/11/24 09:25
Data from CSV not parsed correctly
by dr_panther. 05/06/24 18:50
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
2 registered members (AndrewAMD, kzhao), 642 guests, and 4 spiders.
Key: Admin, Global Mod, Mod
Newest Members
LucasJoshua, Baklazhan, Hanky27, firatv, wandaluciaia
19053 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Searching for multiple words in a document #434979
12/31/13 13:34
12/31/13 13:34
Joined: Feb 2006
Posts: 33
Herts, UK
D
danohu Offline OP
Newbie
danohu  Offline OP
Newbie
D

Joined: Feb 2006
Posts: 33
Herts, UK
Hi

I want to find multiple words in a text file e.g.

file_seek(filehandle,0,0);
xndex = file_find (filehandle, "gun");
xndexi = file_find (filehandle, "weapon");

but searching for one word at a time is inefficient in terms of the number of lines of code. It would be better to be able to search for multiple words e.g.
xndex = file_find (filehandle, "gun" "weapon" "enemy");

although this code does not work and is simply an illustration of what I am trying to achieve. I wondered if this is perhaps possible but:

1) my knowledge of what is possible with Lite-C is lacking?
2) searching for multiple words is possible in the commmercial edition of A8? (wishful thinking I imagine)
3) this is only possible with a DLL using e.g. python code, where one can search for multiple words in this manner including wildcards?

Thanks for your help. Happy 2014!

Re: Searching for multiple words in a document [Re: danohu] #434980
12/31/13 13:42
12/31/13 13:42
Joined: Sep 2003
Posts: 6,861
Kiel (Germany)
Superku Offline
Senior Expert
Superku  Offline
Senior Expert

Joined: Sep 2003
Posts: 6,861
Kiel (Germany)
I assume the text file is already given and not yet to be generated by one of your codes/ editors/ manually? Can't you just try to sort the text file more efficiently?


"Falls das Resultat nicht einfach nur dermassen gut aussieht, sollten Sie nochmal von vorn anfangen..." - Manual

Check out my new game: Pogostuck: Rage With Your Friends
Re: Searching for multiple words in a document [Re: Superku] #434995
01/01/14 04:02
01/01/14 04:02
Joined: Jun 2004
Posts: 2,234
Wisconsin USA
FoxHound Offline
Expert
FoxHound  Offline
Expert

Joined: Jun 2004
Posts: 2,234
Wisconsin USA
Your best bet is to make a wrapper function, put in all the words you want, let the file find run through each individually and then sort them into an array or struct to be returned by the function.


---------------------
There is no signature here.


QUIT LOOKING FOR ONE!

Moderated by  HeelX, Lukas, rayp, Rei_Ayanami, Superku, Tobias, TWO, VeT 

Gamestudio download | chip programmers | Zorro platform | shop | Data Protection Policy

oP group Germany GmbH | Birkenstr. 25-27 | 63549 Ronneburg / Germany | info (at) opgroup.de

Powered by UBB.threads™ PHP Forum Software 7.7.1