Jump to content
  • 0

Variable not being saved in script


Question

Posted

Hello rathena, I made this script, more can be used several times, the variable # vipfree not being saved in global_reg_value, can someone help me.

- script test -1,{
// ---------Settings ----------------------------------
set .nomen$,"^1E90FF[Ragbrus]^000000";
set $nvVip, 1;
set $dVip, 7;
// ----------------------------------------------------------
if (# vipfree == 1) {
mes. nomen $;
mes "have you received" + strcharinfo (0) + ".";
close;
}
mes .nomen$;
mes "Hello" + strcharinfo (0) + "Welcome to Ragbrus!";
mes "do you want to receive your starter kit and 7 days VIP?";
next;
if(select("yes:no")== 2)
{
mes .nomen$;
mes "I'll be waiting for you if you change your mind!";
close;
}
mes .nomen$;
mes "right, here is";
mes "Make good use!";
getitem  607,50;
getitem  12020,50;
getitem 12028,50;
query_sql "UPDATE `login` SET `level` = "+$nvVip+", `dvip` = DATE_ADD(CURDATE(),INTERVAL "+$dVip+" DAY) WHERE `group_idl` = 0 AND `account_id` = "+getcharid(3);
dispbottom "Vip successfully entered! Have a nice game ";
atcommand "@adjgroup 1"+strcharinfo(0);
close;
set #vipfree,1;
end;
}

7 answers to this question

Recommended Posts

Posted (edited)

As far as I know close2 will create a close button and will proceed to the next code until it is stopped with an end. If he wants to update the variable using close then he should put it before close otherwise using close2 should do the trick.

Edited by Verunix
Posted

As far as I know close2 will create a close button and will proceed to the next code until it is stopped with an end. If he wants to update the variable using close then he should put it before close otherwise using close2 should do the trick.

You are indeed right however if Beret edits it like this

set #vipfree,1;
close;

instead of

close2;
set #vipfree,1;
end;

Beret would have one less line of script, which is the point Euphy is trying to make.

Posted (edited)

Thanks to all tested the dua ways putting close2; It worked, thank you all.

close2;
set #vipfree,1;
end;

Edited by Beret
Posted

Glad to help. And wow that is one way of optimizing it, never thought of that haha my mindset was on making the script work. My apologies master Euphy and Arcen D:

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...