I have a battle program, and in the battle program I have multiple menus using "Text()"/"getKey". Everything is lumped together in one main "While" loop (with a few smaller "While" loops inside the big one, for the separate menus).

How do I have a "Back" option that will take the user back to the previous menu WITHOUT using a "Goto"?
What language? I may be able to help, if you send me the source code INCLUDING the GOTO's.
ACagliano wrote:
What language? I may be able to help, if you send me the source code INCLUDING the GOTO's.
TI-BASIC.

The solution is to use a While or Repeat loop. Can you post the code that you have thus far for us to critique?
Using a Goto might be the best solution to this problem. Just make sure you don't create memory leaks.

Using a Repeat loop would work, but it may be messy.
Sure - here it is in it's entirety. Wink


Code:
:ClrDraw
:Text(0,25,"BATTLE!
:Text(15,25,Str3
:Text(25,25,"1. FIGHT
:Text(35,25,"2. HIDE
:While 1
:getKey→E
:If E=93:Then
:randInt(1,20→R
:If R≤{L3}(10:Then
:Text(45,25,"ESCAPED!
:Pause :ClrDraw:Return:End
:If R>{L3}(10:Then
:Text(45,25,"CAN'T ESCAPE!
:Pause
:ClrDraw
:92→E:End:End
:If E=92:Then
:Lbl 1
:Text(0,25,"CHOOSE WEAPON
:Text(25,25,"1. HUMAN
:Text(35,25,"2. COVENANT
:0→E
:While 1
:getKey→E
:If E=92:Then
:ClrDraw
:Text(0,25,"CHOOSE WEAPON
:Text(15,5,"1. MAGNUM      ",{L2}(6),"/",{L2}(7
:Text(25,5,"2. ASSAULT RIFLE      ",{L2}(8),"/",{L2}(9
:Text(35,5,"3. SHOTGUN      ",{L2}(16),"/",{L2}(17
:Text(45,5,"4. SNIPER RIFLE      ",{L2}(18),"/",{L2}(19
:Text(55,5,"5. FRAG GRENADE      ",{L2}(
:Text(55,72,"6. BACK
:
:0→F
:While 1
:getKey→F
:If F=92:Then
:{L1}(1→{L2}(48
:{L1}(2→{L2}(49
:{L2}(6)-{L1}(3→{L2}(6
:{L2}(6→{L2}(50
:{L2}(7→{L2}(51
:"MAGNUM→Str1:End
:If F=93:Then
:{L1}(4→{L2}(48
:{L1}(5→{L2}(49
:{L2}(8)-{L1}(6→{L2}(8
:{L2}(8→{L2}(50
:{L2}(9→{L2}(51
:"ASSAULT RIFLE→Str1:End
:If F=94:Then
:{L1}(16→{L2}(48
:{L1}(17→{L2}(49
:{L2}(16)-{L1}(18→{L2}(16
:{L2}(16→{L2}(50
:{L2}(17→{L2}(51
:"SHOTGUN→Str1:End
:If F=82:Then
:{L1}(19→{L2}(48
:{L1}(20→{L2}(49
:{L2}(18)-{L1}(21→{L2}(18
:{L2}(18→{L2}(50
:{L2}(19→{L2}(51
:"SNIPER RIFLE→Str1:End
:If F=83:Then
:{L1}(52→{L2}(48
:{L1}(53→{L2}(49
:{L2}(3)-{L1}(54→{L2}(3
:{L2}(3→{L2}(50
:4→{L2}(51
:"FRAG GRENADE→Str1:End
:
:If F=84:Goto 1
:
:End
:If E=93:Then
:ClrDraw
:Text(0,25,"CHOOSE WEAPON
:Text(15,5,"1. PLASMA PISTOL      ",{L2}(28),"/",{L2}(29
:Text(25,5,"2. PLASMA RIFLE      ",{L2}(31),"/",{L2}(32
:Text(35,5,"3. NEEDLER       ",{L2}(34),"/",{L2}(35
:Text(45,5,"4. ENERGY SWORD      ",{L2}(49),"/",{L2}(50
:Text(55,5,"5. PLASMA GRENADE      ",{L2}(4
:Text(55,72,"6. BACK
:
:0→F
:While 1
:getKey→F
:If F=92:Then
:{L1}(28→{L2}(48
:{L1}(29→{L2}(49
:{L2}(24)-{L1}(30→{L2}(24
:{L2}(24→{L2}(50
:{L2}(25→{L2}(51
:"PLASMA PISTOL→Str1:End
:If F=93:Then
:{L1}(31→{L2}(48
:{L1}(32→{L2}(49
:{L2}(26)-{L1}(33→{L2}(26
:{L2}(26→{L2}(50
:{L2}(27→{L2}(51
:"PLASMA RIFLE→Str1:End
:If F=94:Then
:{L1}(34→{L2}(48
:{L1}(35→{L2}(49
:{L2}(28)-{L1}(36→{L2}(28
:{L2}(28→{L2}(50
:{L2}(29→{L2}(51
:"NEEDLER→Str1:End
:If F=82:Then
:{L1}(49→{L2}(48
:{L1}(50→{L2}(49
:{L2}(38)-{L1}(51→{L2}(38
:{L2}(38→{L2}(50
:{L2}(39→{L2}(51
:"ENERGY SWORD→Str1:End
:If F=83:Then
:{L1}(55→{L2}(48
:{L1}(56→{L2}(49
:{L2}(4)-{L1}(57→{L2}(4
:{L2}(4→{L2}(50
:4→{L2}(51
:"PLASMA GRENADE→Str1:End
:
:If F=84:Goto 1
:
:End
:
:randInt(1,100→θ
:If θ≤{L2}(49:Then
:{L3}(2)-{L2}(48→{L3}(2
:If {L3}(2≤0:Then
:{L3}(1)+{L3}(2→{L3}(1
:0→{L3}(2
:ClrDraw
:Text(15,25,Str3," HAS NO SHIELDS!
:Pause
:End
:If {L3}(1≤0:Then
:ClrDraw
:Text(35,25,Str2," KILLED ",Str3
:randInt(1,20→θ
:If θ≤{L3}(6:Then
:ClrDraw
:Text(45,25,Str3," DROPPED WEAPON
:Pause
:randInt({L3}(7),{L3}(8)→θ
:If θ>{L2}(50
:θ→{L2}(50
:If {L2}(50>{L2}(51
:{L2}(51→{L2}(50:End
:End:Return:End
:If θ>{L2}(49:Then
:ClrDraw
:Text(35,25,Str2," MISSED!
:Pause
:
:randInt(1,100→θ
:If θ≤{L3}(4:Then
:{L2}(2)-{L3}(5→{L2}(2
:If {L2}(2≤0:Then
:{L2}(1)+{L2}(2→{L2}(1
:ClrDraw
:Text(15,25,Str2," HAS NO SHIELDS!
:Pause
:If {L2}(1≤0:Then
:ClrDraw
:Text(35,25,Str2," DIED!
:Pause
:prgmHALODELV
:Stop
:End:End:End
:If θ>{L3}(4:Then
:ClrDraw
:Text(35,25,Str3," MISSED!
:Pause:End
:
:End
Any custom menu's I've used in the past were small and specifically made for their purpose (usually just "Play, Help, Quit" with only one sub-menu for "Play")

What I did for those was I had it quit the engine if you selected "Help" or "Quit" and then do very specific code for my sub-menu for "Play" but that probably wouldn't interest you very much.

I'd try a generic menu that can load different menu data when you select a certain option of said menu. Because this problem really got me interested, I went ahead and made such an engine. I'd suggest you try and make one yourself, as I found it a little fun to work on, but it may be over your head to do effectively or efficiently. However, if you want to see my engine, I'd gladly share.
The "F=84" part is where the "Back" options would go, and the extra lines are there just to help show the break in the sections.
If I ever get my FFME Title screen menu going fully, I would love to help you out with this.
*Edited my post (this is a "bump" so people notice the edit Razz). When I run that code for the battle program, it waits for a key at the "Human"/"Covenant" menu, but then accepts any key and then goes straight back to the map. I can't see to locate why. Can anyone help me out please? Thanks! Razz
Beta7 wrote:
*Edited my post (this is a "bump" so people notice the edit :P). When I run that code for the battle program, it waits for a key at the "Human"/"Covenant" menu, but then accepts any key and then goes straight back to the map. I can't see to locate why. Can anyone help me out please? Thanks! :P
I just tried the code out myself, and other than a "Error: Undefined" for there being no Str3, it displays Fight, or Hide, then quits the program.
You don't need a Goto for a While loop. Just assign each While a numerical value (1,2,3) etc and when the variable meets that value, that loop will loop until the condition is no longer met.

But, I'm sure you likely knew that much at least.
MufinMcFlufin wrote:
Beta7 wrote:
*Edited my post (this is a "bump" so people notice the edit Razz). When I run that code for the battle program, it waits for a key at the "Human"/"Covenant" menu, but then accepts any key and then goes straight back to the map. I can't see to locate why. Can anyone help me out please? Thanks! Razz
I just tried the code out myself, and other than a "Error: Undefined" for there being no Str3, it displays Fight, or Hide, then quits the program.


Great - now people can't even get past the fight/hide screen. Razz
comicIDIOT wrote:
You don't need a Goto for a While loop. Just assign each While a numerical value (1,2,3) etc and when the variable meets that value, that loop will loop until the condition is no longer met.

But, I'm sure you likely knew that much at least.
And indeed, Goto'ing out of a While loop is a memory leak, which is of course to be avoided.
MufinMcflufin - I would like to see your engine, but only because I've done everything I can think of to fix the problem and nothing is working. I'm hoping to learn how to fix it by comparing our engines. Wink
I happen to notice that two of your If E=...:Then are missing Ends; is that intentional? If not, that's one of your problems.
Beta7 wrote:
MufinMcflufin - I would like to see your engine, but only because I've done everything I can think of to fix the problem and nothing is working. I'm hoping to learn how to fix it by comparing our engines. ;)
Here's where it can be found in the Archives and below is the source code. I'm pretty sure the ReadMe in the .zip will answer all questions, but if you have any more questions (of course after consulting the ReadMe) then ask away, and I'll be sure to add those questions to the ReadMe.

And here's the source code:

Code:

:DelVar ADelVar CSetUpEditorL1
:Repeat C
:ClrDraw
:If not(A
:"MAIN MENU TITLE/OPTION 1/1/OPTION 2/2/OPTION 3/3/QUIT/4//→Str1
:If A=1
:"OPTION 1 TITLE/OPTION 1-1/1.1/OPTION 1-2/1.2/OPTION 1-3/1.3/BACK/0//→Str1
:If A=1.1
:"OPTION 1-1 TITLE/BACK/1//→Str1
:If A=1.2
:"OPTION 1-2 TITLE/BACK/1//→Str1
:If A=1.3
:"OPTION 1-3 TITLE/BACK/1//→Str1
:If A=2
:"OPTION 2 TITLE/OPTION 2-1/2.1/OPTION 2-2/2.2/OPTION 2-3/2.3/BACK/0//→Str1
:If A=2.1
:"OPTION 2-1 TITLE/BACK/2//→Str1
:If A=2.2
:"OPTION 2-2 TITLE/BACK/2//→Str1
:If A=2.3
:"OPTION 2-3 TITLE/BACK/2//→Str1
:If A=3
:"OPTION 3 TITLE/OPTION 3-1/3.1/OPTION 3-2/3.2/OPTION 3-3/3.3/BACK/0//→Str1
:If A=3.1
:"OPTION 3-1 TITLE/BACK/3//→Str1
:If A=3.2
:"OPTION 3-2 TITLE/BACK/3//→Str1
:If A=3.3
:"OPTION 3-3 TITLE/BACK/3//→Str1
:If A=4
:1→C
:If not(C
:Then
:DelVar A1+inString(Str1,"/→B
:Text(0,0,sub(Str1,1,B-2
:While inString(Str1,"/",B)-B
:A+1→A
:Ans→dim(L1
:inString(Str1,"/",B
:Text(6A+1,5,sub(Str1,B,Ans-B
:Ans+1→B
:expr(sub(Str1,Ans,inString(Str1,"/",Ans)-Ans→L1(A
:1+inString(Str1,"/",B→B
:End
:1→A
:Repeat max(B={21,26,105
:Text(6A+1,1,">
:getKey→B
:If 4.5=abs(B-29.5
:Text(6A+1,1,"   
:A-(B=25)+(B=34→A
:dim(L1
:A+Ansnot(A)-Ans(A=Ans+1→A
:End
:L1(Ans→A
:End
:End
:ClrHome
That looks great! I had a hard time stopping my optimization urge from kicking in on all those strings with common substrings before I convinced that part of my brain that in a real program all those strings would be totally different. Smile
As per KermMartian's request (yes, I just had to stick that in here Razz ) :

*Bump*

I added the 2 missing Ends where Kerm said they needed to go, and the program still isn't going past the Fight/Hide menu. In fact, it's now to the point where it just flashes the menu, then goes back to the map/movement program.
Beta7 wrote:
As per KermMartian's request (yes, I just had to stick that in here Razz ) :

*Bump*

I added the 2 missing Ends where Kerm said they needed to go, and the program still isn't going past the Fight/Hide menu. In fact, it's now to the point where it just flashes the menu, then goes back to the map/movement program.
It's not a bump if you're not double-posting and it's not a necrothread, usually. Smile So I looked more closely at your code, and I think I understand what you misunderstand. Reading your code, you think that getKey waits until a key is pressed, then returns that keycode, right? That's wrong. getKey always returns immediately, returning 0 if no key was pressed or the non-zero keycode if a key was pressed.
Beyond that, below is an indented version of your code. Notice that indented code will add a space/tab/"|" when a command (Then/For(/While /Repeat ) is used that would require an End command. Also it decreases the indent when you use an End command. Code that has the proper amount of End commands, won't have an indent at the end of the code.

The only reason why "While 1" wouldn't loop is for two reasons: (1) there isn't an appropriate End command for it, so it would reach the end of the program before it loops, or (2) there's a "Return " command that's preventing the code from going through the entire loop. Your code isn't working as expected for the former reason.

Here's your code as indented so you have a more visual way to look at the code:

Code:

::ClrDraw
:Text(0,25,"BATTLE!
:Text(15,25,Str3
:Text(25,25,"1. FIGHT
:Text(35,25,"2. HIDE
:While 1
:¦ getKey→E
:¦ If E=93:Then
:¦ ¦ randInt(1,20→R
:¦ ¦ If R≤L3(10:Then
:¦ ¦ ¦ Text(45,25,"ESCAPED!
:¦ ¦ ¦ Pause :ClrDraw:Return:End
:¦ ¦ If R>L3(10:Then
:¦ ¦ ¦ Text(45,25,"CAN'T ESCAPE!
:¦ ¦ ¦ Pause
:¦ ¦ ¦ ClrDraw
:¦ ¦ ¦ 92→E:End:End
:¦ If E=92:Then
:¦ ¦ Lbl 1
:¦ ¦ Text(0,25,"CHOOSE WEAPON
:¦ ¦ Text(25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,5,"3. NEEDLER       ",L2(34),"/",L2(35
:¦ ¦ ¦ ¦ ¦ Text(45,5,"4. ENERGY SWORD      ",L2(49),"/",L2(50
:¦ ¦ ¦ ¦ ¦ Text(55,5,"5. PLASMA GRENADE      ",L2(4
:¦ ¦ ¦ ¦ ¦ Text(55,72,"6. BACK
:¦ ¦ ¦ ¦ ¦
:¦ ¦ ¦ ¦ ¦ 0→F
:¦ ¦ ¦ ¦ ¦ While 1
:¦ ¦ ¦ ¦ ¦ ¦ getKey→F
:¦ ¦ ¦ ¦ ¦ ¦ If F=92:Then
:¦ ¦ ¦ ¦ ¦ ¦ ¦ L1(28→L2(48
:¦ ¦ ¦ ¦ ¦ ¦ ¦ L1(29→L2(49
:¦ ¦ ¦ ¦ ¦ ¦ ¦ L2(24)-L1(30→L2(24
:¦ ¦ ¦ ¦ ¦ ¦ ¦ L2(24→L2(50
:¦ ¦ ¦ ¦ ¦ ¦ ¦ L2(25→L2(51
:¦ ¦ ¦ ¦ ¦ ¦ ¦ "PLASMA PISTOL→Str1:End
:¦ ¦ ¦ ¦ ¦ ¦ If F=93:Then
:¦ ¦ ¦ ¦ ¦ ¦ ¦ L1(31→L2(48
:¦ ¦ ¦ ¦ ¦ ¦ ¦ L1(32→L2(49
:¦ ¦ ¦ ¦ ¦ ¦ ¦ L2(26)-L1(33→L2(26
:¦ ¦ ¦ ¦ ¦ ¦ ¦ L2(26→L2(50
:¦ ¦ ¦ ¦ ¦ ¦ ¦ L2(27→L2(51
:¦ ¦ ¦ ¦ ¦ ¦ ¦ "PLASMA RIFLE→Str1:End
:¦ ¦ ¦ ¦ ¦ ¦ If F=94:Then
:¦ ¦ ¦ ¦ ¦ ¦ ¦ L1(34→L2(48
:¦ ¦ ¦ ¦ ¦ ¦ ¦ L1(35→L2(49
:¦ ¦ ¦ ¦ ¦ ¦ ¦ L2(28)-L1(36→L2(28
:¦ ¦ ¦ ¦ ¦ ¦ ¦ L2(28→L2(50
:¦ ¦ ¦ ¦ ¦ ¦ ¦ L2(29→L2(51
:¦ ¦ ¦ ¦ ¦ ¦ ¦ "NEEDLER→Str1:End
:¦ ¦ ¦ ¦ ¦ ¦ If F=82:Then
:¦ ¦ ¦ ¦ ¦ ¦ ¦ L1(49→L2(48
:¦ ¦ ¦ ¦ ¦ ¦ ¦ L1(50→L2(49
:¦ ¦ ¦ ¦ ¦ ¦ ¦ L2(38)-L1(51→L2(38
:¦ ¦ ¦ ¦ ¦ ¦ ¦ L2(38→L2(50
:¦ ¦ ¦ ¦ ¦ ¦ ¦ L2(39→L2(51
:¦ ¦ ¦ ¦ ¦ ¦ ¦ "ENERGY SWORD→Str1:End
:¦ ¦ ¦ ¦ ¦ ¦ If F=83:Then
:¦ ¦ ¦ ¦ ¦ ¦ ¦ L1(55→L2(48
:¦ ¦ ¦ ¦ ¦ ¦ ¦ L1(56→L2(49
:¦ ¦ ¦ ¦ ¦ ¦ ¦ L2(4)-L1(57→L2(4
:¦ ¦ ¦ ¦ ¦ ¦ ¦ L2(4→L2(50
:¦ ¦ ¦ ¦ ¦ ¦ ¦ 4→L2(51
:¦ ¦ ¦ ¦ ¦ ¦ ¦ "PLASMA GRENADE→Str1:End
:¦ ¦ ¦ ¦ ¦ ¦
:¦ ¦ ¦ ¦ ¦ ¦ If F=84:Goto 1
:¦ ¦ ¦ ¦ ¦
:¦ ¦ ¦ ¦ ¦ End
:¦ ¦ ¦ ¦ ¦
:¦ ¦ ¦ ¦ ¦ randInt(1,100→θ
:¦ ¦ ¦ ¦ ¦ If θ≤L2(49:Then
:¦ ¦ ¦ ¦ ¦ ¦ L3(2)-L2(48→L3(2
:¦ ¦ ¦ ¦ ¦ ¦ If L3(2≤0:Then
:¦ ¦ ¦ ¦ ¦ ¦ ¦ L3(1)+L3(2→L3(1
:¦ ¦ ¦ ¦ ¦ ¦ ¦ 0→L3(2
:¦ ¦ ¦ ¦ ¦ ¦ ¦ ClrDraw
:¦ ¦ ¦ ¦ ¦ ¦ ¦ Text(15,25,Str3," HAS NO SHIELDS!
:¦ ¦ ¦ ¦ ¦ ¦ ¦ Pause
:¦ ¦ ¦ ¦ ¦ ¦ End
:¦ ¦ ¦ ¦ ¦ ¦ If L3(1≤0:Then
:¦ ¦ ¦ ¦ ¦ ¦ ¦ ClrDraw
:¦ ¦ ¦ ¦ ¦ ¦ ¦ Text(35,25,Str2," KILLED ",Str3
:¦ ¦ ¦ ¦ ¦ ¦ ¦ randInt(1,20→θ
:¦ ¦ ¦ ¦ ¦ ¦ ¦ If θ≤L3(6:Then
:¦ ¦ ¦ ¦ ¦ ¦ ¦ ¦ ClrDraw
:¦ ¦ ¦ ¦ ¦ ¦ ¦ ¦ Text(45,25,Str3," DROPPED WEAPON
:¦ ¦ ¦ ¦ ¦ ¦ ¦ ¦ Pause
:¦ ¦ ¦ ¦ ¦ ¦ ¦ ¦ randInt(L3(7),L3(8)→θ
:¦ ¦ ¦ ¦ ¦ ¦ ¦ ¦ If θ>L2(50
:¦ ¦ ¦ ¦ ¦ ¦ ¦ ¦ θ→L2(50
:¦ ¦ ¦ ¦ ¦ ¦ ¦ ¦ If L2(50>L2(51
:¦ ¦ ¦ ¦ ¦ ¦ ¦ ¦ L2(51→L2(50:End
:¦ ¦ ¦ ¦ ¦ ¦ End:Return:End
:¦ ¦ ¦ ¦ ¦ If θ>L2(49:Then
:¦ ¦ ¦ ¦ ¦ ¦ ClrDraw
:¦ ¦ ¦ ¦ ¦ ¦ Text(35,25,Str2," MISSED!
:¦ ¦ ¦ ¦ ¦ ¦ Pause
:¦ ¦ ¦ ¦ ¦ ¦
:¦ ¦ ¦ ¦ ¦ ¦ randInt(1,100→θ
:¦ ¦ ¦ ¦ ¦ ¦ If θ≤L3(4:Then
:¦ ¦ ¦ ¦ ¦ ¦ ¦ L2(2)-L3(5→L2(2
:¦ ¦ ¦ ¦ ¦ ¦ ¦ If L2(2≤0:Then
:¦ ¦ ¦ ¦ ¦ ¦ ¦ ¦ L2(1)+L2(2→L2(1
:¦ ¦ ¦ ¦ ¦ ¦ ¦ ¦ ClrDraw
:¦ ¦ ¦ ¦ ¦ ¦ ¦ ¦ Text(15,25,Str2," HAS NO SHIELDS!
:¦ ¦ ¦ ¦ ¦ ¦ ¦ ¦ Pause
:¦ ¦ ¦ ¦ ¦ ¦ ¦ ¦ If L2(1≤0:Then
:¦ ¦ ¦ ¦ ¦ ¦ ¦ ¦ ¦ ClrDraw
:¦ ¦ ¦ ¦ ¦ ¦ ¦ ¦ ¦ Text(35,25,Str2," DIED!
:¦ ¦ ¦ ¦ ¦ ¦ ¦ ¦ ¦ Pause
:¦ ¦ ¦ ¦ ¦ ¦ ¦ ¦ ¦ prgmHALODELV
:¦ ¦ ¦ ¦ ¦ ¦ ¦ ¦ ¦ Stop
:¦ ¦ ¦ ¦ ¦ ¦ ¦ ¦ End:End:End
:¦ ¦ ¦ ¦ ¦ ¦ If θ>L3(4:Then
:¦ ¦ ¦ ¦ ¦ ¦ ¦ ClrDraw
:¦ ¦ ¦ ¦ ¦ ¦ ¦ Text(35,25,Str3," MISSED!
:¦ ¦ ¦ ¦ ¦ ¦ ¦ Pause:End
:¦ ¦ ¦ ¦ ¦
:¦ ¦ ¦ ¦ ¦ End
Notice that you're missing about 5 End commands.

Usually what I do to prevent this from happening is when I code on the calc, I'll immediately add and End command for it, then insert lines, and work on those inserted lines. This way I never worry about having the appropriate number of End's.

Another thing I'll usually do to prevent this is code on paper or on the computer, and indent as I go.
  
Register to Join the Conversation
Have your own thoughts to add to this or any other topic? Want to ask a question, offer a suggestion, share your own programs and projects, upload a file to the file archives, get help with calculator and computer programming, or simply chat with like-minded coders and tech and calculator enthusiasts via the site-wide AJAX SAX widget? Registration for a free Cemetech account only takes a minute.

» Go to Registration page
» Goto page 1, 2, 3, 4, 5  Next
» View previous topic :: View next topic  
Page 1 of 5
» All times are UTC - 5 Hours
 
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

 

Advertisement