|
-
Nov 13th, 2025, 01:13 AM
#1
Thread Starter
PowerPoster
Need a way to parse tags that contain parameters
So my game is getting polished up and there's a thing I've been avoiding but thinking about almost the entire time I've been working on it.
I've posted my code for the content editor in code bank several times.
It's a text-based game that can contain tags such as <He/She>, <Him/Her>, <Player First Name>, etc.
They're all simple replacements.
If LCase$(Token)="<player first name>" then
sReturn = Player.FirstName
end if
The problem is when I want do something with parameters such as <PlaySound: BigGong>, <PlaySound: TireSqueal>, <PlaySound: PeopleScreaming>, etc.
----------------------
Your friend opens the door to let you into his apartment.
"I have something to show you."
He points at the biggest gong you have ever seen. It's suspended a foot from the floor and almost reaches the ceiling.
"Cool, huh?"
<PlaySound: BigGong>
'If you say so. Why?'
----------------------
Part of the problem is that anything I use for brackets can also just be used as text.
So the text could contain something like, "Your friend points over there -> <PlaySound: BigGong> (sorry I couldn't come up with a better example.
I can parse the tag once I have it. The problem is how to pull it out of the text. Because partial tags can be anywhere it would take a lot more smarts than I have to parse it and figure out which tags go with which.
Also too, I don't get regular expressions at all so it will need it to be kind of specific and not just a general idea if that's how you think I should do it.
Thanks.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|