Hey guys, I edited up Knuckles Q menu that he posted here awhile back and i'm just having one problem.
It seems to want to stop doing anything once you relogin.
(Also doesn't seem to list the name of the first #w it is on when you first get it. Either that or the Bow doesn't have a #w )
[code]if(playerenters) {
toweapons -QMENU;
timeout = 0.05;
}
if(created&&isweapon){
timeout = 0.05;
}
if(keypressed) {
if(keydown2(keycode(q),true) && this.kq == 0) {
if(this.enabled == 0) {
disabledefmovement;
setplayerprop #m ,idle;
playersprite = 13;
this.selected = selectedweapon;
this.enabled = 1;
} else {
enabledefmovement;
playersprite = 0;
this.enabled = 0;
}
this.kq = 1;
timeout = 0.05;
}
}
if (timeout) {
this.index = this.selected;
for(i=0; i<pi2; i+=pi 2/weaponscount) {
showimg 600+this.index,#W (this.index),playerx+.5+sin(pi+i)*4,playery+1+cos(pi+i)*4;
showimg 651,@#w (this.index+1),playerx-1.5+sin(pi+i)*4,playery+6.5+cos(pi+i)*4;
changeimgzoom 651,.6;
if(this.index == weaponscount-1) this.index = -1; this.index++;
}
if(keydown(1) && this.k1 == 0) {
if(this.selected >= 1) this.selected-=1;
elseif(this.selected == 0) this.selected = weaponscount-1;
play nextpage.wav; this.k1 = 1;
}
elseif(keydown(3) && this.k3 == 0) {
if(this.selected < weaponscount-1) this.selected+=1;
elseif (this.selected == weaponscount-1) this.selected = 0;
play nextpage.wav; this.k3 = 1;
}
selectedweapon = this.index;
if (!keydown(3)) this.k3 = 0;
if (!keydown(1)) this.k1 = 0;
if (keydown2(keycode(q),false)) this.kq = 0;
if(this.enabled == 1) timeout = 0.05;
else {hideimgs 600,600+weaponscount; hideimg 651;}
}[/code]
Re: QMenu
Seems to be heavily reliant on a timeout.
Sidenote:
if(created&&isweapon){
timeout = 0.05;
}
if(created){…} currently doesn't work o_o
Dispite this being a bastardization:
if(playerenters&&isweapon){
timeout = 0.05;
}
It is what you want to fix this part of the code.
Re: QMenu
I think the if (created) are working, used it in a few other scripts. This one and another one wouldn't seem to run after the keypressed.
for (i=0;i<weaponscount;i++) {
if (strequals(#w (i),QMENU)) {
callweapon i,keypressed;
}
}
Seemed to fix it for this and another npc. Anyways thanks
Re: QMenu
Keypressed is a trigger o_o Don't need to call a flag of 'keypressed' in the selected weapon o_o
Re: QMenu
Figured i'd need to call something, since calling keypressed seemed like an okay idea I went with it.
You can use callweapon blah,; then i'm guessing?
Re: QMenu
callweapon is a great alternative to using self-provoking triggeractions, its based on indexes instead of x,y though.
I use it to control the 'delete' system in my QMenu
Re: QMenu
Just be warned, it is not an instantaneous call. There is a 0.05 second delay.
Agret
December 9, 2007, 8:11am
9
Re: QMenu
Fixed Somewhat (No random timeout on entry)
if(playerenters){
if(isweapon)
{
enablefeatures allfeatures-4;
}else{
toweapons -QMENU;
}
}
if(keypressed)
{
if(keydown2(keycode(q),true) && this.kq == 0)
{
if(this.enabled == 0)
{
disabledefmovement;
setplayerprop #m,idle;
playersprite = 13;
this.selected = selectedweapon;
this.enabled = 1;
timeout = 0.05;
}
else
{
enabledefmovement;
playersprite = 0;
this.enabled = 0;
}
this.kq = 1;
}
}
if (timeout)
{
this.index = this.selected;
// setplayerprop #c,#e(0,1,#w(this.index));
for(i=0; i<pi*2; i+=pi*2/weaponscount)
{
showimg 600+this.index,#W(this.index),playerx+.5+sin(pi+i)*4,playery+1+cos(pi+i)*4;
showimg 651,@#w(this.index+1),playerx-1.5+sin(pi+i)*4,playery+6.5+cos(pi+i)*4;
changeimgzoom 651,.6;
if(this.index == weaponscount-1) this.index = -1; this.index++;
}
if(keydown(1) && this.k1 == 0)
{
if(this.selected >= 1) this.selected-=1;
elseif(this.selected == 0) this.selected = weaponscount-1;
play nextpage.wav; this.k1 = 1;
}
elseif(keydown(3) && this.k3 == 0)
{
if(this.selected < weaponscount-1) this.selected+=1;
elseif (this.selected == weaponscount-1) this.selected = 0;
play nextpage.wav;
this.k3 = 1;
}
selectedweapon = this.index;
if (!keydown(3)) this.k3 = 0;
if (!keydown(1)) this.k1 = 0;
if (keydown2(keycode(q),false)) this.kq = 0;
if(this.enabled == 1) { timeout = 0.05; }
else {hideimgs 600,600+weaponscount; hideimg 651;}
}
Re: QMenu
didn't think enable features worked in this version.
Re: QMenu
if (created) only works about 1/4 of the time, and in the code supposedly it is not built in correctly …
Re: QMenu
Snake Rekon (Events Captain) :
if (created) only works about 1/4 of the time, and in the code supposedly it is not built in correctly …
That is why you use
if (created || playerenters) { CODE; }
This way the code is initialized everytime a player enters or it is created.
Re: QMenu
cough Some events, you may only want to be initialized once, either because the NPC relies on it being done once, or because it'll lag.
if(playerenters && this.init != true) {
Add Your Stuff Here
this.init = true;
}
Re: QMenu
Ew I had 'this.init == true;'
== is for statements and comparisons.
= is for assigning. O_o
Spooon
December 13, 2007, 3:35pm
16
Re: QMenu
Just listen to Dungeons & Dragons Man.