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
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.
Assault Andy Administrator
I make other people create vaporware
Registered 29/07/2002
Points 5686
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.
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)
.
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
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.
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.
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.
"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. ***