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
Need Help!!!
Moderator: POL Developer
Re: Need Help!!!
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
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
Re: Need Help!!!
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
Re: Need Help!!!
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! =)
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! =)
-
- Distro Developer
- Posts: 2825
- Joined: Thu Feb 02, 2006 1:41 pm
- Location: San Antonio, Texas
- Contact:
Re: Need Help!!!
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!
I'm sure you already know about the documentation link. But if not be sure to check it out. Oh and welcome to POL!