Graal Forums

Graal Forums (https://forums.graalonline.com/forums/index.php)
-   NPC Scripting (https://forums.graalonline.com/forums/forumdisplay.php?f=8)
-   -   Showimg Dissapearing (https://forums.graalonline.com/forums/showthread.php?t=53764)

Kramer 07-15-2004 02:04 AM

Showimg Dissapearing
 
I have a script that uses showimg, and everytime I heal or lose life, just the default ones that is, there is no special HP script that I'm using, the showimg images dissapear. Thease images are attached to the client's screen, not the level, index of 4+ or whatever, and their indexes are all 200+. Is there a known solution to this problem or do I need to post the script? Anyhow, help would be much apreciated.

osrs 07-15-2004 02:13 AM

Would be better if you could post the part that is apparently causing the problem, such as any hideimg part or even showstats i guess.

Kramer 07-15-2004 02:44 AM

NPC Code:

if (created){
this.pos = 15;
this.speed = 1;
}
if (weaponfired && this.bootson == 1){
hideimg nums;
this.bootson = 0;
for(this.speedsel=0;this.speedsel<=5;this.speedsel ++){
hideimg 200+(this.speedsel);
}
hideimg 230;
hideimg 231;
this.pos =15;
}
else if (weaponfired){
this.bootson = 1;
for(this.speedsel=1;this.speedsel<=5;this.speedsel ++){
this.pos=this.pos+20;
showtext 200+(this.speedsel),this.pos,115,,,#v(this.speedse l);
changeimgvis 200+(this.speedsel),5;
}
showimg 231,admingui.gif,10,115;
changeimgvis 231,4;
timeout = .05;
}
if (timeout && this.bootson == 1) {
for (i=0;i<4;i++) {
if (keydown(i)) {
playerx += (vecx(i)/2)*this.speed;
playery += (vecy(i)/2)*this.speed;
}
}
showtext 230,30,135,,,X: #v(mousescreenx) Y: #v(mousescreeny);
changeimgvis 230,5;
if (mousescreenx in |35,45| && mousescreeny in |120,135|){
if(leftmousebutton){
this.speed = 1;
sleep .5;
}
}
if (mousescreenx in |55,65| && mousescreeny in |120,135|){
if(leftmousebutton){
this.speed = 2;
sleep .5;
}
}
if (mousescreenx in |75,85| && mousescreeny in |120,135|){
if(leftmousebutton){
this.speed = 3;
sleep .5;
}
}
if (mousescreenx in |95,105| && mousescreeny in |120,135|){
if(leftmousebutton){
this.speed = 4;
sleep .5;
}
}
if (mousescreenx in |115,125| && mousescreeny in |120,135|){
if(leftmousebutton){
this.speed = 5;
sleep .5;
}
}
timeout = .05;
}



there's the problematic code, all clientside

osrs 07-15-2004 06:19 PM

Quote:

Originally Posted by Kramer
NPC Code:

if (weaponfired && this.bootson == 1){
hideimg nums;
this.bootson = 0;
for(this.speedsel=0;this.speedsel<=5;this.speedsel ++){
hideimg 200+(this.speedsel);
}
hideimg 230;
hideimg 231;
this.pos =15;
}



there's the problematic code, all clientside

That hideimg is weird, there is no such variable on script with that name.
Talk to me over AIM if you need help to fix it.

WanDaMan 07-15-2004 07:16 PM

Even though you are right osrs, that wouldn't be the problem. That hideimgs part is only called when the weapon has been fired twice.

Also, please, I beg you to re-write the script. Do something like this for the mouse detection.

NPC Code:

if (mousebuttons == 1 && mousescreeny in |120,135|) {
for (this.a = 0; this.a < 5; this.a ++) {
if (mousescreenx in |35 + (this.a * 20),45 + (this.a * 20)|){
this.speed = this.a + 1;
sleep .5;
}
}
}



You accomplish the same thing with 8 lines, instead of 30.

osrs 07-15-2004 07:23 PM

I did not say that was the wrong part, i just said that there wasn't such variable on script. Kramer sent me a message some minutes ago and told me that he fixed it anyway. :)

WanDaMan 07-15-2004 07:28 PM

I see I see.

Please mention to him about the mouse detection. I don't even want to get started on the weaponfired part...

Loriel 07-15-2004 07:47 PM

Pft, trolls.

The problem is known. I first experienced it myself when I scripted what I claim to be Graal's first custom health bar (for Kharlia :D) shortly after changeimgvis was introduced.
Since then I have been displaying all such NPCs in a 0.05sec timeout loop. It has worked fine, but now that we have custom health stuff almost everywhere, that practice is getting rather bothersome.

Kramer 07-16-2004 05:16 AM

thanks, I'm going to change that moust detection thing, my solution was as loriel said and eventially the weaponfired part will be done away with altogether.

Alexander 07-16-2004 05:29 AM

Loriel got to post the answer before me :(


All times are GMT +2. The time now is 05:03 PM.

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.
Copyright (C) 1998-2019 Toonslab All Rights Reserved.