ID:166618
 
Alright, I'm coding a DBZ game and I'm trying to figure out how to code the Power-Up verb. At first I figure I should use a for() loop to check and see when the characters powerlevel meets or exeeds it's max powerlevel and then end the procedure. But now I'm starting to realize that it will keep looping and once I reach full powerlevel i'll get spammed with the message "You have reached full power." Then I considered a while() loop but by this time I became so confused I had to go watch TV for a couple hours to clear my head. Could someone give a little prod in the right direction please?
This should work; its simple enough.
while(src.pl < src.maxpl)//while its less than their max
src.pl += src.maxpl/5//add a 5th of their power etc/
if(src.pl >= src.maxpl)//if its greater or equal to
src.pl = src.maxpl
break//stop the while proc

I almost got a lil confused while making that(XD), but that should do it..
In response to Mecha Destroyer JD
You don't need the break in there. This is the politically correct code:

src<<"<i>You start powering up.</i>"
//insert eyecandy here
//insert possible movement lockdown here
while(src.pl < src.maxpl)src.pl+=src.maxpl/5 //add a 5th of their maxpl to their pl
src.pl=src.maxpl //it might be a bit over the maximum. Remove this if you want this to occur for more randomization
//stop possible movement lockdown here
//remove eyecandy here
src<<"<i>You finish powering up.</i>"


Also, I'd like to warn you that on your days as a DBZ game developer, you may face the horrible fact that DBZ on BYOND has been raped so many times that it's become impossible to create a good DBZ game. Even the good DBZ games are being suppressed, because you can't distinguish between the hub entries anymore (EVERYONE has fancy icons, EVERYONE says that they're not ripping, MOST spell correctly, and MOST of the people have correct key names; there is nothing to see a good game from a bad game anymore just by eyesight)
In response to Android Data
The worse the others are, the better mine will look as far as I'm concerned. I've always liked DBZ but I never really wanted to make a game for it until I saw the mutated injustices that people were publishing. Some of them are all the same, I know. So I feel it's my duty to set the standard now. I know thats hard to trust because there are so many games out there that say the same thing, which is also the reason I'm afraid to recruit a staff in Classified adds, so I'm stuck doing this one all by myself. In fact it's kind of an oxymoron because I'm using ripped icons because I can't find an iconer. My idea was to publish a trial version of my game(yes with ripped icons which I WOULD give credit for) and then advertise my game in the classified so that people could see the idea's I have and the originality(other than the icons) and hopefully an iconer will come forth. Sorry to ramble. My point? Anything is possible, as cliche as it sounds.
In response to Teris
Teris wrote:
The worse the others are, the better mine will look as far as I'm concerned.
So I feel it's my duty to set the standard now.

That's so cliché. Even I, leader of the hidden "RABAGDBZGG" (Revolt Against BYOND And Get Dragon Ball Zeta Games Gone =P), formost hater of the hub spam (I even counter-spammed and got myself banned once!) was like that once. Yeah, all those other games suck so let's set things right.
Ah well, have your fun. You seem like an OK coder and possibly iconmaker, so I'm sure yours won't turn out as a rip and can be ignored safely.

Now if you'll excuse me, I need to lead a crusade to the BYOND HQ, if I can manage to find it. Now how do we get someone with Instant Transmission to take us to Tom?
In response to Android Data
Think of it this way. If my game is good enough the Zeta/Rebirth/Elysium rips WILL go away.
In response to Teris
Teris wrote:
If my game is good enough the Zeta/Rebirth/Elysium rips WILL go away.

Ha! Ambitious as you may be, I once thought like you, young grasshoppa'. They won't go away. Multiple reasons:

1) People are too stupid to understand that the DBZ game they're in is yet another rip.
2) Players want to gain lots of PL. They want power. The rips provide them with power, as the owners of them will make their buddies "GMs".
3) There are so many DBZ rips that yours will barely get noticed by some people.
4) The players dislike change. They'll stay in the same game.

There will always be rips around here. Even if DBZ gets killed (which I doubt, as it would take an armada of Chuck Norris-type humans to kick the asses of the owners of such games), there will still be Naruto (DBZ for girls) to battle with.
The best we can hope for is that the filter system gets implemented, and we'll be able to filter out the smut.
In response to Android Data
Okay here is my code now:

mob/verb
Power_Up()
set category= "Techniques"
var/powering
if(src.powering)
powering= 0
busy= 0
Return_State()
src<<"<b><font color=white>You have stopped powering up!</font></b>"

Busy()
if(!busy)
alert("What would you like to power up?","Power Up","Powerlevel","Ki")

if("Powerlevel")
while(src.pl< src.maxpl)
powering= 1
busy= 1
Save_State()
icon_state= "Enrage"
src.pl+= src.maxpl/5
if(src.pl>= src.maxpl)
busy= 0
Return_State()
src.pl= src.maxpl
src<<"<b><font color=white>You have reached full power!</font></b>"
break

if("Ki")
while(src.ki< src.maxki)
powering= 1
busy= 1
Save_State()
icon_state= "Enrage"
src.pl+= src.maxki/5
if(src.ki>= src.maxki)
busy= 0
Return_State()
src.ki= src.maxki
src<<"<b><font color=white>You have reached full ki!</font></b>"
break



The problem is in the first part. In the if statement that checks if the src is already powering. If they are, it returns them back to normal. My question is how do I terminate the while loop?
In response to Teris
mob/verb
Power_Up()
set category= "Techniques"
var/powering
if(src.powering)
powering=0
return //if you don't do this, it'll mess up and continue to power up, which is bad. Baad.
Busy()
if(!busy)
alert("What would you like to power up?","Power Up","Powerlevel","Ki","Cancel")

if("Powerlevel")
powering=1
busy=1
Save_State()
icon_state="Enrage"
while(src.pl< src.maxpl&&powering) //while we're powering up AND we're below our max PL
src.pl+= src.maxpl/5
if(src.pl>=src.maxpl) //if we're done
src.pl= src.maxpl //make sure PL hasn't exceeded MAXPL
src<<"<b><font color=white>You have reached full power!</font></b>"
else src<<"<b><font color=white>You have stopped powering up your powerlevel!</font></b>"
busy= 0
Return_State()
src<<"<b><font color=white>You have reached full power!</font></b>"
if("Ki")
powering= 1
busy= 1
Save_State()
icon_state= "Enrage"
while(src.ki< src.maxki&&powering)src.pl+= src.maxki/5
if(src.ki>= src.maxki)
src.ki= src.maxki
src<<"<b><font color=white>You have reached full ki!</font></b>"
else src<<"<b><font color=white>You have stopped powering up your KI!</font></b>"
busy= 0
Return_State()
In response to Android Data
Now this is my code, once again:

mob/verb
Power_Up()
set category= "Techniques"
if(src.powering)
powering= 0
busy= 0
Return_State()
src<<"[INFORMATIVEFONT]You stop powering up![FONTCLOSURE]"
return

Busy()
if(!busy)
alert("What would you like to power up?","Power Up","Powerlevel","Ki")

if("Powerlevel")
if(src.pl>= src.maxpl)
src<< "[RESTRICTIVEFONT]You are at full power![FONTCLOSURE]"
return
src<< "[INFORMATIVEFONT]You focus intensly, steadily raising your power.[FONTCLOSURE]"
powering= 1
while(src.pl< src.maxpl&&powering)
busy= 1
Save_State()
icon_state= "Enrage"
src.pl+= src.maxpl/5
if(src.pl>= src.maxpl)
busy= 0
Return_State()
src.pl= src.maxpl
src<< "[INFORMATIVEFONT]You have reached full power![FONTCLOSURE]"
break


if("Ki")
if(src.ki>= src.maxki)
src<< "[RESTRICTIVEFONT]Your ki is at it's max![FONTCLOSURE]"
return
src<< "[INFORMATIVEFONT]You concentrate on your energy, increasing it with ease.[FONTCLOSURE]"
while(src.ki< src.maxki&&powering)
powering= 1
busy= 1
Save_State()
icon_state= "Enrage"
src.pl+= src.maxki/5

if(src.ki>= src.maxki)
busy= 0
Return_State()
src.ki= src.maxki
src<<"[INFORMATIVEFONT]You have reached full ki![FONTCLOSURE]"
break</dm

It appears fine to me. But whenever I attempt to powerup my ki, it runs as if I had clicked powerlevel.What's wrong?
In response to Teris
Oops! I didn't realise that when I skimmed over your code earlier.

alert("What would you like to power up?","Power Up","Powerlevel","Ki")


That's the problem. You're alerting the player, but you aren't getting anything back.

switch(alert("What would you like to power up?","Power Up","Powerlevel","Ki"))
if("Powerlevel")
...
if("Ki")
...


That is the correct code.
In response to Teris
You don't have an if statement for "Power Up"

if("Power Up")
In response to Digital Stompy
Digital Stompy wrote:
You don't have an if statement for "Power Up"

That's because "Power Up" is the title of the alertbox, not a selection.
In response to Android Data
Sorry, I usually use those input boxes. o.o
In response to Android Data
Okay another problem:
    Power_Up()
set category= "Techniques"
if(src.powering)
powering= 0
busy-= 0
Return_State()
src<<"[INFORMATIVEFONT]You stop powering up![FONTCLOSURE]"
return 0

Busy()
if(!busy)
switch(alert("What would you like to power up?","Power Up","Powerlevel","Ki"))

if("Powerlevel")
if(src.pl>= src.maxpl)
src<< "[RESTRICTIVEFONT]You are at full power![FONTCLOSURE]"
return

src<< "[INFORMATIVEFONT]You focus intensly, steadily raising your power.[FONTCLOSURE]"
src.powering+= 1
while(src.pl< src.maxpl&&powering)
src.busy+= 1
Save_State()
icon_state= "Enrage"
src.pl+= src.maxpl/5

if(src.pl>= src.maxpl)
src.busy= 0
Return_State()
src.pl= src.maxpl
src<< "[INFORMATIVEFONT]You have reached full power![FONTCLOSURE]"
break


if("Ki")
if(src.ki>= src.maxki)
src<< "[RESTRICTIVEFONT]Your ki is at it's max![FONTCLOSURE]"
return
src<< "[INFORMATIVEFONT]You concentrate on your energy, increasing it with ease.[FONTCLOSURE]"
while(src.ki< src.maxki&&powering)
powering+= 1
busy+= 1
Save_State()
icon_state= "Enrage"
src.pl+= src.maxki/5

if(src.ki>= src.maxki)
busy-= 0
Return_State()
src.ki= src.maxki
src<<"[INFORMATIVEFONT]You have reached full ki![FONTCLOSURE]"
break


This is my most recent power up code but it neither stops the usr if they are busy nor stops the power up when the click it when they are powering up. Whats wrong now? Does it have something to do with how I used the variables?