Register to post in forums, or Log in to your existing account
 

Play RetroMUD
Post new topic  Reply to topic     Home » Forums » zMUD General Discussion
mAdM0nK
Beginner


Joined: 17 Apr 2001
Posts: 14
Location: USA

PostPosted: Wed Nov 28, 2001 9:56 am   

special character variable help
 
Im trying to store special characters into some variables but i cant seem to get them to show up, special characters being braces {} or brackets [] or parentheses ()'s. ive tried using ~ before the character i want put into the variable but whenever i try to use a trigger to say the variable, those characters wont show up.
Right now this is what i have:

#var BsLine {I just @BSText @mult @TwistText @JustBsed to @TargCond @TargPercent at @RoomName My HP: @CurrentHP @SanctFlag @EFsmessage @PKType}

and this is what it looks like when i backstab someone

I just SINGLED 6.0 A gypsy merchant to Dead! 0% at Market Street My HP: 603 NO SANCT! LPK

ive tryed doing #1 and #2, and variations of the two:
Example #1:

#var BsLine {"I just ["@BSText"] ["@mult"] " @TwistText "[ "@JustBsed" ]" to @TargCond "["@TargPercent"]" at "[ "@RoomName" ]" My HP: @CurrentHP "["@SanctFlag"]" @EFsmessage "["@PKType"]"}

Example #2:

#var BsLine {I just ~[@BSText~] ~[@mult~] @TwistText ~[ @JustBsed ~] to @TargCond ~[@TargPercent~] at ~[ @RoomName ~] My HP: @CurrentHP ~[~@SanctFlag~] @EFsmessage ~[@PKType~]}

basically just trying to get it so it looks like above but has brackets seperating every few things
ie.

I just [SINGLED] [6.0] A gypsy merchant to Dead! (0%) at [ Market Street ] My HP: 603 NO SANCT! [LPK]

or something similar...

ive also tryed going to each individual variable and storing the brackets/braces/etc in those triggers as well, but it seems that you cant store them in variables.
Any thoughts?
Reply with quote
Acaila
Apprentice


Joined: 30 Aug 2001
Posts: 187
Location: Netherlands

PostPosted: Wed Nov 28, 2001 11:23 am   
 
Those brackets can be tricky yeah.
When you try to fill the variable you need a tilde in front of each bracket, like you're doing in your example #2. However when you call that variable in a trigger or something, those brackets you have stored will be evaulated AGAIN. So, you'll need to store the tilde in front of each bracket as well. To do this I think you'll need 3 tildes in front of each bracket when you first store it (one will be substracted to get a [, a second will be substracted to get a ~).

#VAR BsLine {{I just ~~~[@BSText~~~] ~~~[@mult~~~].........}

Well, so much for that thought. I tested it, and it indeed stores them correctly, but a #SAY or #SHOW still won't get the bracket out (it does give a tilde though).
Maybe this can help you further along though.

Acaila
Reply with quote
mAdM0nK
Beginner


Joined: 17 Apr 2001
Posts: 14
Location: USA

PostPosted: Mon Dec 03, 2001 6:22 pm   
 
Well, I tried doing the multiple ~~~ let you suggested but i cant get the characters to show up. I've got no idea why either. Been trying for like 2 weeks now, and it looks like you cant store them in variables. I could be wrong, and hopefully someone knows how to do this.
Reply with quote
Acaila
Apprentice


Joined: 30 Aug 2001
Posts: 187
Location: Netherlands

PostPosted: Mon Dec 03, 2001 6:53 pm   
 
It's a good thing you reposted on this subject, because Zugg just gave the solution to your problems in another post recently.

Use the %expand function.

First, save your variable like this:
#var BsLine {I just ~[@BSText~] ~[@mult~] @TwistText ~[ @JustBsed ~] to @TargCond ~[@TargPercent~] at ~[ @RoomName ~] My HP: @CurrentHP ~[~@SanctFlag~] @EFsmessage ~[@PKType~]}

Then to call it use:
%expand(@BsLine,1)
Put that in a #SAY or #SHOW or #SUB or however you wanted it to output.

This should result in what you intended.

Acaila
Reply with quote
MattLofton
GURU


Joined: 23 Dec 2000
Posts: 4834
Location: USA

PostPosted: Tue Dec 04, 2001 12:04 am   
 
quote:

Well, I tried doing the multiple ~~~ let you suggested but i cant get the characters to show up. I've got no idea why either. Been trying for like 2 weeks now, and it looks like you cant store them in variables. I could be wrong, and hopefully someone knows how to do this.



Aside from %expand, %char works too. Just a lot more cumbersome.

li'l shmoe of Dragon's Gate MUD
Reply with quote
Display posts from previous:   
Post new topic   Reply to topic     Home » Forums » zMUD General Discussion All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum

© 2009 Zugg Software. Hosted by Wolfpaw.net