Simplifying a Menu Script

Inflikted

LOMCN Veteran
Veteran
Aug 4, 2003
256
7
114
Just a small little script, to showcase, how you can simplify a repetitive menu down. What use to be a much larger code, is simplified down to about 100 lines of code, for easier editing and use. I've helped alot of people on msn, who don't seem to know this little trick and end up with huge repetitive scripts, that are tedious to edit.
hope this helps you :), let me know if you guys need any explanations, as im just showcasing the script, and assuming you no whats going on :) pay close attention to the variables used. those are the most critical parts.. to getting a script like this to work.

Code:
[@FameMenu]
#IF
CheckFame
#ACT
Mov D4 %P9  ; Amount of FP
#SAY
Welcome to the Famepoint rebirth system.\
Currently we offer 8 rebirths to our members.\
Attaining all of them is not an easy task.\
Currently you have <$OUTPUT(D4)> FP's\
<Rebirth/@rebirthmenu>\

[@rebirthmenu]
#SAY
< Level 1 - 100 FP - Lvl100 - 60million gold/@rebirthauto(1,100,100,60000000)>\
< Level 2 - 200 FP - Lvl200 - 80million gold/@rebirthauto(2,200,200,80000000)>\
< Level 3 - 250 FP - Lvl300 - 100million gold/@rebirthauto(3,250,300,100000000)>\
< Level 4 - 300 FP - Lvl400 - 120million gold/@rebirthauto(4,300,400,120000000)>\
< Level 5 - 450 FP - Lvl500 - 150million gold/@rebirthauto(5,450,500,150000000)>\
< Level 6 - 550 FP - Lvl850 - 200million gold/@rebirthauto(6,550,850,200000000)>\
< Level 7 - 650 FP - Lvl1050 - 500million gold/@rebirthauto(7,650,1050,500000000)>\
< Level 8 - 900 FP - Lvl1200 - 1Billion gold/@rebirthauto(8,900,1200,1000000000)>

[@rebirthauto()]
#ACT
Mov D5 %ARG(1)
Mov D6 %ARG(2)
Mov D0 %ARG(3)
Mov D8 %ARG(4)

goto @dorebirth

[@dorebirth]
#IF
ELARGE D4 %D6
checkgold %D8
checklevel %D0
!HLSCRIPTCMD CHECKRELEVEL %D5
#ACT
DEC D4 %D6
SetFame %D4
take gold %D8
HLSCRIPTCMD REINCARNATION
HLSCRIPTCMD CLEAREXP
#SAY
You got <$HLREINCARNATION> rebirth now.\
#ELSESAY
You are short on something to gain this Rebirth.\
<[ Exit ]/@exit>\\\