-
Posts
130 -
Joined
-
Last visited
Content Type
Profiles
Forums
Downloads
Jobs Available
Server Database
Third-Party Services
Top Guides
Store
Crowdfunding
Posts posted by plankt
-
-
The compare functions wants the variable type "string". It receives an integer.
You can solve this by type-casting the variables from integer to string.
Look at the green part. By adding an empty string, you make sure that it is a string:
compare(""+var, ...)
-
For Windows Vista/7. What OS are you using?
You should in any OS be able to set owner and permission for the RO folder. Make sure your user has write permission.
-
I've had that problem before. The problem is indeed with the .lua files and starting the .exe as admin worked for me.
- 1
-
Make sure no files in the RO folder is read-only
If that doesn't help, start RO as admin.
- 1
-
Could you show the errors?
- 1
-
If you don't want the dialogue open, you can add the green line.
Switched place of the two orange lines to make sure the shop is attached before we call it.
mes "Select only one.";close2;
npcshopattach "quest_shop1";
callshop "quest_shop1",1;
end;
On each OnInit, the shops content is removed by:
npcshopitem "quest_shop1",0,0;
And no items are added after that.
-
If you only have the statement, only 1 command will be executed for each loop. Ex:
for(...) mes "This will be looped"; mes "This will not be looped"; for(...) mes "This will be looped"; mes "This will not be looped";
If you surround the code with { } then all the code inside will be executed each loop. Ex:
for(...){ mes "This will be looped"; mes "This will be looped"; } mes "This will not be looped";
-
For the first one, if you only want to announce once, then add the announce like below:
for(set @i,@i+1; getarg(@i)!=0; set @i,@i+2) getitem getarg(@i),getarg(@i+1); announce "Yay, the player got items",bc_all;
If you want it to announce for each item, change the for loop like this: (to make sure it does both commands for each loop)
for(set @i,@i+1; getarg(@i)!=0; set @i,@i+2){ getitem getarg(@i),getarg(@i+1); announce "Yay, the player got another item",bc_all; }
For the second one, you can add an announce, like I did in the first example, after the line which gives the item:
getitem $CB_Prize[.@d], $CB_Prize[.@d+3]; // Add announce here
-
What you're looking for could be:
*callshop "<name>",<option>;These are a series of commands used to create dynamic shops.
The callshop function calls a invisible shop (view -1) as if the player clicked on it.
For the options on callShop:
0 = The normal window (buy, sell and cancel)
1 = The buy window
2 = The sell window
Example(s):
callshop "DaShop",1; //Will call the shop named DaShop and opens the buy menu.
It will open a normal shop. You need to have that shop as a script already.
-
-<tab>script<tab>Shop5<tab>-1,{ ... OnShop: ... }
*doevent "<NPC object name>::<event label>";This command will start a new execution thread in a specified NPC object at the
specified label. The execution of the script running this command will not stop.
No parameters may be passed with a doevent call.
The script of the NPC object invoked in this manner will run as if it's been
invoked by the RID that was active in the script that issued a 'doevent'.
place' date='100,100,1%TAB%script%TAB%NPC%TAB%53,{
mes "This is what you will see when you click me";
close;
OnLabel:
mes "This is what you will see if the doevent is activated";
close;
}
doevent "NPC::OnLabel";[/quote']
-
You can switch "OnPCLoginEvent" for:
OnNPCKillEvent:This special label triggers when a player kills a monster.
And use a temporary char variable to keep track of monsters killed, ex:
// Increase the mobs killed by 1 set @mobskilled, @mobskilled+1; // If the user has killed less then 80 mobs, don't run the script if(@mobskilled < 80) end; // Then reset the variable so we can start counting again set @mobskilled, 0;
-
The function gettime() returns only what you specify.
gettime(3) will give you the hour only.
Since you can only arrive at the if check at two possible times, 19:00 and 20:30, you only need to check for the days and that specific hour.
OnClock1900: // Start time OnClock2030: // End time // Check for Sunday or Wednesday AND that it is starttime if((gettime(4) == 0 || gettime(4) == 3) && gettime(3) == 19) {
I'm guessing you have an "end time check" at the end of that if. Make sure to change that check to something like this:
// Check for Sunday or Wednesday AND that it is endtime if((gettime(4) == 0 || gettime(4) == 3) && gettime(3) == 20) {
*gettime(<type>)This function will return specified information about the current system time.
...
3 - Hour (of a day)
...
-
You can save the AID where the variable $HighestPoringPointsName$ is set.
Then at OnTimer310000 you can attachrid and give the reward. Make sure to remove the price part from the standard NPC.
For the second, change this:
} initnpctimer; end; OnPCDieEvent:
To this:
} killmonsterall "quiz_01"; mapannounce "quiz_01","You have won, approach the Present For You Npc please.",0; enablenpc "Present For You"; stopnpctimer; end; OnPCDieEvent:
-
Test with the array:
setarray $Forbidden[0],1002;
And you should only get a Poring.
If that works, then it's the IDs that are wrong.
If that does not work, then please post the whole script on http://upaste.me
-
Ah, mistake from my part. Ignore what I said about the for-loop.
Change:
do { set .@guessrepeat, 0; set $monster, 1000 + rand(1,950); for (set .@k, 0; .@k <getarraysize($Forbidden); set .@k, .@k+1){ if ($monster == $Forbidden[.@k]){ set .@guessrepeat, 1; break; } } } while (.@guessrepeat);
To
set $monster, $Forbidden[rand(getarraysize($Forbidden))];
Note: It can ONLY choose ids from the $Forbidden array if you do this edit.
That way you can have arrays with monsters and select from them, ex:
setarray .@mvps, id1, id2, id3, ...; set $monster, .@mvps[rand(getarraysize(.@mvps))];
-
I'd rather change
set @failchance,rand(100);
To
set @failchance,100;
-
-
I did answer that one in the previous thread you made.
For the first error, you can get rid of it by adding "end;" before "L_LadderMove:".
It should not, but could, affect the script.
end; L_LadderMove:
Reason for the error:
The event 'OnPCKillEvent' is activated but the script isn't ended before reaching 'L_LadderMove'.
It then reaches
if (getarg(0) == 0) set @length,@beginmoving;
Which executes the error.
-
Same error?
Also, upload the updated script to www.upaste.me
-
Find all those and change
atoi(...)to
atoi(""+...)where ... is the content
-
Something like this:
OnPCLoginEvent: // Get the data to array @VotePoints, since we only get 1 value it will be treated as a variable, .@n is amount of rows set .@n, query_sql("SELECT `points` FROM `cp_v4p_voters` WHERE `account_id` = '"+getcharid(0)+"'", @VotePoints); // If we got data if(.@n){ // Update his/her values to 0 query_sql("UPDATE `cp_v4p_voters` SET `points` = 0 WHERE `account_id` = '"+getcharid(0)+"'"); // Update the CASHPOINTS var set #CASHPOINTS, #CASHPOINTS+@VotePoints; } end;
Check the variables, names and code before using.
- 1
-
For the first error, you can get rid of it by adding "end;" before "L_LadderMove:".
It should not, but could, affect the script.
end; L_LadderMove:
For the "Expected string" errors. You need to give the function the correct type of values for it to work.
It expects an integer, gets a string. There's 2 ways to fix it.
1) Typecast, change ex: getstrlen(var) to getstrlen(""+var). You add an empty string to force it to turn in to a string.
2) Check if the function is needed at all. You send an integer in to the function atoi which is used to turn string to integers = not needed.
-
This is called typecasting. You have an integer and using Lilith method, you turn it in to a string, since compare expects two strings.
If you want to go the other direction, you can use *atoi() to turn a string in to an integer.
-
Does it enter the label "OnEndInstance" at all?
If it does, check if .@a$ is set to an empty string or the map name.
The script or player might not be attached to an instance, in that case you could save the instance ID and supply to the script command.
*has_instance("<map name>"{,<instance id>});
If you want an alternative to scanning all the IDs to check who is on the map, you can try to:
*instance_warpall "<map name>",<x>,<y>{,<instance id>};
And have a reward NPC they can talk to, or activate an OnTouch on arrival.
Auto Kick or Return to save point when AFK
in Scripting Support
Posted
You can check if the player haven't moved in a set time interval, it's no safe bet that he/she is afk tho.
For more information, look up: getmapxy, sleep2 and OnPCLoadMapEvent.