The Daily Click ::. Forums ::. Klik Coding Help ::. How could I load specified line from .txt
 


 

Posted By Message
This thread has been locked by an administrator

EleXor



Registered
  21/01/2003
Points
  269
4th August, 2005 at 10:19:35 -

I'm having problems with system creating magical items with prefix + suffix in my Ultima-like game (eg. bronze dagger of slaying +1).
I wish that when you pick up the item, it would like randomize the item id, and when in inventory, the system would be like this:
-Dagger is selected
-Upon pressing enter
-> Add line 151 from something.txt to log list
So basically I want to load ONE line from a .txt / .html or what ever, not the whole thing.

OH and one more thing.
Let's say I have txt which looks like this:
Weapon damage type str req dex req id
Epee 2-9 foil 5 20 131

How come I could load only eg. "2-9" damage value?
Thanks, (if somebody actually did understand)
EleXor

 
n/a

Radix

hot for teacher

Registered
  01/10/2003
Points
  3139

Has Donated, Thank You!VIP MemberGOTW WINNER CUP 1!GOTW WINNER CUP 2!GOTW WINNER CUP 3!GOTW WINNER CUP 4!
4th August, 2005 at 11:59:26 -

I suppose you could read in the file as though it were an INI, then use a parsing extension that looks for the (invisible) line break character to split up slabs of text, store them, increment a counter and repeat. When the counter equals the line number the desired text should've been separated and stored.

Same thing for the second question but after you have the correct line, parse with respect to tabs or spaces or whatever and do something similar to find the correct column.

Maybe.

 
n/a

EleXor



Registered
  21/01/2003
Points
  269
4th August, 2005 at 12:46:19 -

Sounds good.
Here is a picture for reference of the game:
http://img27.imageshack.us/img27/5720/radixisacake1ps.png

Image Edited by the Author.

 
n/a

EleXor



Registered
  21/01/2003
Points
  269
13th August, 2005 at 05:48:56 -

Anybody has actually made an example of this?

 
n/a

Assault Andy

Administrator
I make other people create vaporware

Registered
  29/07/2002
Points
  5686

Game of the Week WinnerVIP Member360 OwnerGOTM JUNE - 2009 - WINNER!GOTM FEB - 2010 - WINNER!	I donated an open source project
13th August, 2005 at 08:30:54 -

Use string parser 2 for the 2-9 value. Set the delimeter to " ", which is a space. This means that string parser 2 breaks up the sentance into parts that you can easily retrieve. "Epee 2-9 foil 5 20 131" becomes:
Epee
2-9
foil
5
20
131

If you wanted to return 2-9, then you would ask for element number two.

 
Creator of Faerie Solitaire:
http://www.create-games.com/download.asp?id=7792
Also creator of ZDay20 and Dungeon Dash.
http://www.Jigxor.com
http://twitter.com/JigxorAndy

EleXor



Registered
  21/01/2003
Points
  269
14th August, 2005 at 08:17:01 -

I'm terribly sorry, but I don't know anything about string parser, I just have it on mmf. So is there a example / tutorial / article of using it?

 
n/a

Radix

hot for teacher

Registered
  01/10/2003
Points
  3139

Has Donated, Thank You!VIP MemberGOTW WINNER CUP 1!GOTW WINNER CUP 2!GOTW WINNER CUP 3!GOTW WINNER CUP 4!
14th August, 2005 at 08:54:46 -

Yes.

 
n/a

EleXor



Registered
  21/01/2003
Points
  269
14th August, 2005 at 10:30:59 -

Thanks for sort and clear answer, that helped a lot.
Now new question:
GIVE LINK TO GOOD EXAMPLE / TUTORIAL
(good one tells things like to a newb like me who doesn't know anything about the extension)
.

 
n/a

Radix

hot for teacher

Registered
  01/10/2003
Points
  3139

Has Donated, Thank You!VIP MemberGOTW WINNER CUP 1!GOTW WINNER CUP 2!GOTW WINNER CUP 3!GOTW WINNER CUP 4!
14th August, 2005 at 12:07:26 -

http://create-games.com/cs_search.asp

 
n/a

EleXor



Registered
  21/01/2003
Points
  269
14th August, 2005 at 14:46:03 -

I seached, but didn't find which I needed.
What I need, in a nutshell:
When a player picks up an magical item, it saves up the PREFIX (if it has one), NAME (eg. flail) and SUFFIX (if it has one) and generates an unique id for it, and it would look like this in the file:
magical_items_picked.txt
1. 2151, VAMPYRIC, FLAIL <- prefix, no suffix
2. 1213, VENOMOUS, EPEE, OF STRENGHT +6 <- prefix and suffix
3. 0912, CROOK <- no prefix or suffix, in otherwords: "normal" item

And when player is EXAMINING / LOOKING for the item with id of eg. 0912 in the inventory, it would tell this:
Crook

Or if player is looking at the 1213
Venomous epee of strenght +6

Got it? o_O

I know one system how this would work, but it would be lame and require 1k+ extra codelines, because there is over 20 different weapons, 20's of suffixes and prefixes...
I don't want to make this
IF weapon is vampyric mace of slaying +1
If weapon is vampyric mace of slaying +2
---
If weapon is vampyric mace of slayng +15
If weapon is mace of slaying +1
---
If weapon is mace of slaying +15



Image Edited by the Author.

 
n/a

Radix

hot for teacher

Registered
  01/10/2003
Points
  3139

Has Donated, Thank You!VIP MemberGOTW WINNER CUP 1!GOTW WINNER CUP 2!GOTW WINNER CUP 3!GOTW WINNER CUP 4!
14th August, 2005 at 23:15:02 -

Yeah, it bothers me when I can't find an article that tells me EXACTLY how to make my game.
You can either look up stuff on string parsing and do it yourself (it isn't difficult, but you need to learn how the parsers work), or you can wait in this thread for someone to give you the code, but you won't learn anything and it will make writing this game of yours harder in the long run.

 
n/a

EleXor



Registered
  21/01/2003
Points
  269
15th August, 2005 at 00:54:49 -

What the hell? I can make that part in MY WAY but it's more time taking.
You say I can't make game? Well I have made BEST fightning engine I've seen here (not released though) which counts in following things:
weapon speed, weapon power, weapon accuracy, weapontype (if mace, then better cricital etc.), defense, blocking, hp, possible spells. So stop giving me those answers and don't steal avatars, which you didn't make,
thanks.

 
n/a

Radix

hot for teacher

Registered
  01/10/2003
Points
  3139

Has Donated, Thank You!VIP MemberGOTW WINNER CUP 1!GOTW WINNER CUP 2!GOTW WINNER CUP 3!GOTW WINNER CUP 4!
15th August, 2005 at 01:43:13 -

Sure, overreacting like a dipshit noob is going to make people rush to help you. Like I said, it's not difficult. It'd take five minutes if you'd just read up on string parsing and follow the advice people've already given you. And if you can't handle something this simple, don't fuck on about what a great coder you are.

 
n/a

EleXor



Registered
  21/01/2003
Points
  269
15th August, 2005 at 02:07:34 -

"Sure, overreacting like a dipshit noob is going to make people rush to help you. Like I said, it's not difficult. It'd take five minutes if you'd just read up on string parsing and follow the advice people've already given you. And if you can't handle something this simple, don't fuck on about what a great coder you are."
Lingo:
Noob = annoying person
Newbie = starter
And I don't consider myself as 'annoying person'.
If I say that I'm good in making combat formulas + fightning engine it doesn't mean that I'm a "great coder". I could rather say that I have the imagination needed.
I bet you don't even know Ultima, so I'm not expecting help from you.
And once more, please don't steal avatars.

I have experience two hours of string parsing with no luck at all.

*** this thread was about asking help, not fightning. If you have to say your argument now, please, do it on PM, not here to grow dc points / virtual penis.
Post only if you have something that might help me with that system mentioned before. ***

Image Edited by the Author.

 
n/a

Radix

hot for teacher

Registered
  01/10/2003
Points
  3139

Has Donated, Thank You!VIP MemberGOTW WINNER CUP 1!GOTW WINNER CUP 2!GOTW WINNER CUP 3!GOTW WINNER CUP 4!
15th August, 2005 at 02:20:15 -

Unforunately, you aren't the one that gets to decide whether you're a pain in the ass or not. If you don't like it, don't act like a dick.

 
n/a
This thread has been locked by an administrator



 



Advertisement

Worth A Click