Need Help!!!

Get Help on scripting in POL with configurations, config setups, script trouble shooting, etc.

Moderator: POL Developer

Post Reply
User avatar
Mypaxa
New User
Posts: 4
Joined: Fri Oct 15, 2010 3:11 pm

Need Help!!!

Post by Mypaxa »

Hello. Have only recently started studying in scripting. I decided to write a script that performs the function .Concealme double-click on a GM robe.
In invisibility gets double-clicked, but absenteeism from it. Prompt that you want to append. The core of POL 96.
The script:

use uo;
use os;

include "include/client";
include "include/attributes";

program dblclick_gmrobe( who, gmrobe )

if (who.concealed == 0)
who.concealed := 1;
endif
if(who > who.cmdlevel)
who := who.cmdlevel;
endif
if (who.concealed == 1)
who.concealed := 1;
endif
if(who.cmdlevel >= 2)
endif
endprogram
User avatar
Austin
Former Developer
Posts: 621
Joined: Wed Jan 25, 2006 2:30 am

Re: Need Help!!!

Post by Austin »

Code: Select all

use uo;
use os;

include "include/client";
include "include/attributes";

program dblclick_gmrobe( who, gmrobe )

if (who.concealed == 0)
who.concealed := 1;
endif
if(who > who.cmdlevel)
who := who.cmdlevel;
endif
if (who.concealed == 1)
who.concealed := 1;
endif
if(who.cmdlevel >= 2)
endif
endprogram
While this may compile, it will not work. I first suggest changing the variable 'who' to 'user' to make it more understandable.
I also suggest *ALL* scripters begin using more meaningful variables than 'who' such as 'mobile' if its a user or npc and 'user' if its a real person. It will make your code more understandable to newbies.

Ill comment the code on what is going on.

Code: Select all

if ( who.concealed == 0 ) // This will execute if the user is not concealed.
who.concealed := 1; // This will conceal the user at level 1 (can go up to user.cmdlevel)
endif

if ( who > who.cmdlevel ) // This will result in an error. You are comparing the 'who' (a mobile object) with a property that is an integer. The results of this check are unpredictable.
    who := who.cmdlevel; 
endif

if ( who.concealed == 1 ) // If the user is concealed AT level 1, enter this
   who.concealed := 1; // Redundant. the user is set to concealed at 1, but was already concealed at 1, thats how this if statement was entered.
endif

if ( who.cmdlevel >= 2 ) // Nothing performed if this criteria is met?
endif

endprogram
User avatar
Austin
Former Developer
Posts: 621
Joined: Wed Jan 25, 2006 2:30 am

Re: Need Help!!!

Post by Austin »

Interpreting what you are trying to accomplish, here is how I would go about it.

Code: Select all

use uo;

program UseScript(user, gmrobe)
     if ( !user.concealed ) // User.concealed == 0
          user.concealed := user.cmdlevel;
          SendSysMessage(user, "Concealed at level "+user.concealed);
     else
          user.concealed := 0;
          SendSysMessage(user, "Unconcealed.");
     endif
     
     return 1;
endprogram
User avatar
Mypaxa
New User
Posts: 4
Joined: Fri Oct 15, 2010 3:11 pm

Re: Need Help!!!

Post by Mypaxa »

Thank you very much. Austin, do not say where to get good manual for self learning scripting??
I listened to your advice, but the fact that I did neizuchal any programming language, so it is very hard to learn. No literature desired.
But the desire itself is learned. Help me please! =)
Yukiko
Distro Developer
Posts: 2825
Joined: Thu Feb 02, 2006 1:41 pm
Location: San Antonio, Texas
Contact:

Re: Need Help!!!

Post by Yukiko »

Mypaxa you can learn to script even if you have never programmed before. Just be patient with yourself and do what you are already doing, study the simple scripts and ask questions.

I'm sure you already know about the documentation link. But if not be sure to check it out. Oh and welcome to POL!
Post Reply