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
OmegaDeus
Apprentice


Joined: 14 Sep 2005
Posts: 121

PostPosted: Sun Oct 09, 2005 6:55 am   

String list help
 
I've recently found out the beaty of making little GUIs using string lists to get certain lines just right and not have to sort through all of the crap to get to the line that's messed up (becuase most of my GUIs have been formed in the realms of substitute). But here's the code i usually use to construct my GUIs.

Code:

#sub %replace(@experience(%1,%2),"|",%cr)


That's all find and dandy for most of my minor GUIs that I haven't made into complete "boxes" as I like to put it, but there's one exception to all this. It'd be my first two major accomplishments. The prompt trigger and the followup addition of the compass to it.

Code:

*-------------------------------------------------------* *-------------*
|Jubilee    5                                           | |     (N) |U| |
*-------------------------------------------------------* |      |      |
|Health: 176/176     Body: 207/207     Mind: 156/156    | |  NW  |  NE  |
*-------------------------------------------------------* |    \ | /    |
|ETL: 26688Time: 4am Til Q: 0 On Q: 0 Q Points: 122     | |(W)--[O]--(E)|
*-------------------------------------------------------* |    / | \    |
|Exits: NESWUDNeSeSwNw Area: Bastion                    | |  SW  |  SE  |
*-------------------------------------------------------* |      |      |
|Enemy:                Me: Excl                         | |     (S) |D| |
*-------------------------------------------------------* *-------------*


I want to make this into a string list as well, but there's the little issue of the |'s being replaced by %crs that would just completely jack this all up. Is there some way I could get this into a string list, or am i pretty much SOL on this one?
Reply with quote
MattLofton
GURU


Joined: 23 Dec 2000
Posts: 4834
Location: USA

PostPosted: Sun Oct 09, 2005 4:35 pm   
 
You had to create that from your prompt, which means you were handling the information part-by-part. You can build the stringlist there in your prompt trigger using the %additem() function (it allows duplicates).

Prompt = %additem(%1,@Prompt)
_________________
EDIT: I didn't like my old signature
Reply with quote
OmegaDeus
Apprentice


Joined: 14 Sep 2005
Posts: 121

PostPosted: Sun Oct 09, 2005 5:13 pm   
 
the variables aren't what i'm worried about, what i'm worried about is putting say this line into the stringlist, cuz when i use the code that turns my string list into the layed out gui it would mess with the |'s that i use and turn those into %cr's and that'd severely jack the layout up.

line:
Code:
|Jubilee    5                                           | |     (N) |U| |
Reply with quote
MattLofton
GURU


Joined: 23 Dec 2000
Posts: 4834
Location: USA

PostPosted: Sun Oct 09, 2005 6:02 pm   
 
You aren't having problems getting it into the stringlist, right? Try using %expandlist(). Not sure if that will work with carriage returns or not, but if not you can just loop the stringlist using #FORALL and #SAY/#ECHO/#SHOW %i.
_________________
EDIT: I didn't like my old signature
Reply with quote
OmegaDeus
Apprentice


Joined: 14 Sep 2005
Posts: 121

PostPosted: Sun Oct 09, 2005 6:12 pm   
 
%expandlist doesn't work, it just sows all the lines on one line, and the forall doesn't work cuz it tries to execute each line and i end up with all kinds of weird stuff.

Code:

55
40mSkillup
]
56
]
51
40m%1
]
56
Reply with quote
MattLofton
GURU


Joined: 23 Dec 2000
Posts: 4834
Location: USA

PostPosted: Sun Oct 09, 2005 10:25 pm   
 
#forall doesn't execute anything. All it does is loop through the condition string, helpfully isolating each element in the stringlist so that the user can do awful things to it (like sending it off to the MUD). Post the code you got, and we'll hammer it out.
_________________
EDIT: I didn't like my old signature
Reply with quote
Vijilante
SubAdmin


Joined: 18 Nov 2001
Posts: 5182

PostPosted: Mon Oct 10, 2005 2:22 am   
 
Make the triggers that use #SUBSTITUTE more specific. You are already rebuilding your prompt and then #SUBbing it one set of triggers. Why do you have another set even detecting the recently #SUBbed text?! I am at a loss to even understand how you have this sort of conflict.

On a second note it sounds like you are trying apply a newer priciple to an older script. If the script is working, and you are not improving it; then it makes no sense to change it. Of course you always build your original #SUBbing prompt stuff with '│' instead of '|'. In most fonts the former will display as a solid line, but it is different from the zMud list seperator character.
_________________
The only good questions are the ones we have never answered before.
Search the Forums
Reply with quote
OmegaDeus
Apprentice


Joined: 14 Sep 2005
Posts: 121

PostPosted: Tue Oct 11, 2005 12:30 am   
 
You've misread what I'm trying to do. I've got other triggers that sub text the one way, and uses a stringlist so that I can more easily work on just one line of the output gui to get it exactly as i need. The problem is that I want to do the same with my prompt trigger because it looks like this currently:

Code:

#var exits %replace( %replace( %replace( %replace( "%12", "Se", "g"), "Sw", "j"), "Nw", "h"), "Ne", "f")
#sub {*%repeat( "-", 55)* *%repeat( "-", 13)*%cr|%ansi(12)%char%repeat(" ",4)%ansi(9)@level%ansi(2)%repeat(" ",51-%eval(%len(%char)+%len(@level)))| |%repeat(" ",5)%if(%pos("N",@exits),%ansi(15)~(%ansi(14)N%ansi(15)~),%repeat(" ",3)) %if(%pos("U",@exits),%ansi(15)|%ansi(14)U%ansi(15)|,%repeat(" ",3)) %ansi(2)|%cr*%repeat( "-", 55)* |%repeat(" ",6)%if(%pos("N",@exits),%ansi(9)|," ")%repeat(" ",6)%ansi(2)|%cr|%ansi(12)Health%ansi(15): %ansi(9)%1%ansi(15)/%ansi(9)%2%repeat(" ",11-%eval(%len(%1)+%len(%2)))%ansi(12)Body%ansi(15): %ansi(9)%3%ansi(15)/%ansi(9)%4%repeat(" ",11-%eval(%len(%3)+%len(%4)))%ansi(12)Mind%ansi(15): %ansi(9)%5%ansi(15)/%ansi(9)%6%repeat(" ",10-%eval(%len(%5)+%len(%6)))%ansi(2)| |%repeat(" ",2)%if(%pos("h",@exits),%ansi(12)NW,%repeat(" ",2))%repeat(" ",2)%if(%pos("N",@exits),%ansi(9)|," ")%repeat(" ",2)%if(%pos("f",@exits),%ansi(12)NE,%repeat(" ",2))%repeat(" ",2)%ansi(2)| %cr*%repeat( "-", 55)* |%repeat(" ",4)%if(%pos("h",@exits),%ansi(9)\," ") %if(%pos("N",@exits),%ansi(9)|," ") %if(%pos("f",@exits),%ansi(9)/," ")%repeat(" ",4)%ansi(2)|%cr|%ansi(12)ETL%ansi(15): %ansi(9)%7%repeat(" ",5-%len(%7))%ansi(12)Time%ansi(15): %ansi(9)%8 %ansi(12)Til Q%ansi(15): %ansi(9)%9 %ansi(12)On Q%ansi(15): %ansi(9)%10 %ansi(12)Q Points%ansi(15): %ansi(9)%11%ansi(2)%repeat(" ",13-%eval(%len(%11)+%len(%8)+%len(%9)+%len(%10)))| |%if(%pos("W",@exits),%ansi(15)~(%ansi(14)W%ansi(15)~)%ansi(9)--,%repeat(" ",5))%ansi(15)~[%ansi(12)O%ansi(15)~]%if(%pos("E",@exits),%ansi(9)--%ansi(15)~(%ansi(14)E%ansi(15)~),%repeat(" ",5))%ansi(2)|%cr*%repeat( "-", 55)* |%repeat(" ",4)%if(%pos("j",@exits),%ansi(9)/," ") %if(%pos("S",@exits),%ansi(9)|," ") %if(%pos("g",@exits),%ansi(9)\," ")%repeat(" ",4)%ansi(2)|%cr|%ansi(12)Exits%ansi(15): %ansi(9)%12%repeat(" ",15-%len(%12))%ansi(12)Area%ansi(15): %ansi(9)%13 %ansi(2)%repeat(" ",26-%len(%13))| |%repeat(" ",2)%if(%pos("j",@exits),%ansi(12)SW,%repeat(" ",2))%repeat(" ",2)%if(%pos("S",@exits),%ansi(9)|," ")%repeat(" ",2)%if(%pos("g",@exits),%ansi(12)SE,%repeat(" ",2))%repeat(" ",2)%ansi(2)|%cr*%repeat( "-", 55)* |%repeat(" ",6)%if(%pos("S",@exits),%ansi(9)|," ")%repeat(" ",6)%ansi(2)|%cr|%ansi(12)Enemy%ansi(15): %ansi(9)%14%repeat(" ",14-%len(%14)) %ansi(12)Me%ansi(15): %ansi(9)%15%repeat(" ",29-%len(%15))%ansi(2)| |%repeat(" ",5)%if(%pos("S",@exits),%ansi(15)~(%ansi(14)S%ansi(15)~),%repeat(" ",3)) %if(%pos("D",@exits),%ansi(15)|%ansi(14)D%ansi(15)|,%repeat(" ",3)) %ansi(2)|%cr*%repeat( "-", 55)* *%repeat( "-", 13)*}


I want to clean that up from one long ass line to a stringlist so that I can edit say the enemy, me line. In a stringlist i know this would be no problem cuz it falls in the 10th line, but in this i've gotta manually look through it for )|%cr|%ansi(12)Enemy%ansi(15): %ansi(9)%14%repeat(" ",14-%len(%14)) %ansi(12)Me%ansi(15): %ansi(9)%15%repeat(" ",29-%len(%15))%ansi(2)| |%repeat(" ",5)%if(%pos("S",@exits),%ansi(15)~(%ansi(14)S%ansi(15)~),%repeat(" ",3)) %if(%pos("D",@exits),%ansi(15)|%ansi(14)D%ansi(15)|,%repeat(" ",3)) %ansi(2)|. This trigger was the main reason i got into using stringlists for the others, but unlike the others this one has |'s which the stringlist automatically uses to separate the lines when you pull it up. I replace those with %cr in all the others an it's no problem, but with this one if I did that it'd look quite messed up. Would the %replace skip a | if i used ~|? I just thought of that and maybe if it does I have my solution. Please let me know what you think.
_________________


Look at me I've got zSKILLS
Reply with quote
MattLofton
GURU


Joined: 23 Dec 2000
Posts: 4834
Location: USA

PostPosted: Tue Oct 11, 2005 2:26 am   
 
I should have suggested this earlier, but I really think you should use a datarecord variable. It allows for easy access to specific keys, so if you order the keys by line you should be able to call up just the line you are having trouble with. To make it a tad more fancy, you could simply store the plain data in the datarecord (each key would contain a stringlist of the items that appear on that line) and then draw it out using the stringlist functions. This will allow you to make the data available for other scripts which probably won't need the GUI stuff, while still making it easy to create the GUI.

Your GUI alias would be something like this:

#alias display {#show %format("the format string", %ansi(some color)%item(@Prompt.line1,1), %item(@Prompt.line1,2)%ansi(default), etc)}
_________________
EDIT: I didn't like my old signature
Reply with quote
OmegaDeus
Apprentice


Joined: 14 Sep 2005
Posts: 121

PostPosted: Tue Oct 11, 2005 4:14 am   
 
You've got me intrigued, please explain further, remember that I'm quite the script n00b just poking around til I make stuff work. A little more info about me, I used to be a marine (y'know Muscles Are Required Intelligence Not Essential), and as we used to say in the Marines, I sort of need this to be in "Marine Terms" which means it needs to be broke down beyond barney style. If a 2 day old infant can't understand it, then it's not dumbed down enough. :P
_________________


Look at me I've got zSKILLS
Reply with quote
OmegaDeus
Apprentice


Joined: 14 Sep 2005
Posts: 121

PostPosted: Tue Oct 11, 2005 4:45 am   
 
I just got done looking at a datarecord, I remember someone referred one to me on a database question a while back. It works in that instance, but I don't see how it would work here.
_________________


Look at me I've got zSKILLS
Reply with quote
OmegaDeus
Apprentice


Joined: 14 Sep 2005
Posts: 121

PostPosted: Wed Oct 12, 2005 1:04 am   
 
I found the solution I needed, Twas quite simple really, but I was too out of it to realize it until I was at work today. I just replaced all the | in my prompt with © then used this to make it work

Code:
#sub %replace(%replace(@prompt(%1,%2,%3,%4,%5,%6,%7,%8,%9,%10,%11,%12,%13,%14,%15),"|",%cr),"©","|")


That works for now, but i'm about to change that to even less by making the trigger automatically set the variables when pattern matching and have the prompt draw from the variables.
_________________


Look at me I've got zSKILLS
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