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

EleXor



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

don't act like a dick.

What the hell do you have against persons with name 'Dick'?

This will be the last time:
If you don't know ultima series, then don't bother keep spamming.
I KNOW those points will grow up your ego, but please, don't spam this one.
Thanks

Image Edited by the Author.

 
n/a

DaVince

This fool just HAD to have a custom rating

Registered
  04/09/2004
Points
  7998

Game of the Week WinnerClickzine StaffHas Donated, Thank You!Cardboard BoxDos Rules!
15th August, 2005 at 04:34:47 -

What are you people all being difficult?

You just make a list object, load a list "textfile" (where all your lines are), go to a specific line when needed and set an editbox text to its current text + a new line + the text of the selected listbox line.
That's the simplest way to do it. Don't forget to save the edit box containing the log somewhere, too.

Image Edited by the Author.

 
Old member (~2004-2007).

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 05:14:51 -

Oh, I like the ninja edit there, elexor. You still sound like a wanker. And, I don't know what you think it has to do with string parsing, but I've played the early Ultimas. In any case, Ultima didn't invent the -fix item system.

 
n/a

EleXor



Registered
  21/01/2003
Points
  269
15th August, 2005 at 05:35:57 -

'You still sound like a wanker'
Yep, because I am one. I ejaculate (or how do you say it) 2-3 times per day. Isn't it better to make love with self than go to rape some innocent person?

Da vince:
Go to specified line
No. as I said, that would require 1k's of line.
I wan't the system automatically find the right line, and then set edit box to text of the current line.

 
n/a

EleXor



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

'Dear God, what a twat you are...'

Yes sir, you're the one that that teached me this all.

 
n/a

EleXor



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

Don't try to escape from this! You're the one responsible...
PROOF:
MSN talking:
15.8.2005, 23:00
PHIZZY <3 says:
hi baby
EleXor says:
what the fuck?
PHIZZY <3 says:
have you ever ejaculated on keyboard
EleXor says:
NOW THIS IS SICK!

This never ended... Phizzy kept talking to me like this, and therefore I finally blocked him.

 
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 13:13:21 -

Failure.

 
n/a

EleXor



Registered
  21/01/2003
Points
  269
15th August, 2005 at 14:24:01 -

Failure. The best adjective for you.
Yeh, you're the load your mom should've swallowed.

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 14:51:57 -

I think he's just a dumb kid. The variety that have to wear helmets and sit at the front of the bus.
The DC sure is a big bus.

 
n/a

Pete Nattress

Cheesy Bits img src/uploads/sccheesegif

Registered
  23/09/2002
Points
  4811
15th August, 2005 at 14:59:08 -

What in sweet Jesus Christ's name is going on here. Quiet down ya damn varmits!

 
www.thenatflap.co.uk

Pete Nattress

Cheesy Bits img src/uploads/sccheesegif

Registered
  23/09/2002
Points
  4811
15th August, 2005 at 14:59:13 -

Administrative Message: This topic has been locked.

 
www.thenatflap.co.uk
This thread has been locked by an administrator



 



Advertisement

Worth A Click