Jump to content
  • 0

Variable not being saved in script


Beret

Question


  • Group:  Members
  • Topic Count:  60
  • Topics Per Day:  0.01
  • Content Count:  174
  • Reputation:   3
  • Joined:  06/19/12
  • Last Seen:  

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;
}

Link to comment
Share on other sites

7 answers to this question

Recommended Posts


  • Group:  Members
  • Topic Count:  72
  • Topics Per Day:  0.02
  • Content Count:  2997
  • Reputation:   1130
  • Joined:  05/27/12
  • Last Seen:  

close;
set #vipfree,1; // Doesn't execute
end;

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  0
  • Topics Per Day:  0
  • Content Count:  5
  • Reputation:   0
  • Joined:  05/22/12
  • Last Seen:  

Try using close2 instead of close.

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  72
  • Topics Per Day:  0.02
  • Content Count:  2997
  • Reputation:   1130
  • Joined:  05/27/12
  • Last Seen:  

@Verunix: That's not needed, a "close" at the end is sufficient.

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  0
  • Topics Per Day:  0
  • Content Count:  5
  • Reputation:   0
  • Joined:  05/22/12
  • Last Seen:  

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
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  69
  • Topics Per Day:  0.02
  • Content Count:  1315
  • Reputation:   372
  • Joined:  12/10/11
  • Last Seen:  

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.

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  60
  • Topics Per Day:  0.01
  • Content Count:  174
  • Reputation:   3
  • Joined:  06/19/12
  • Last Seen:  

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

close2;
set #vipfree,1;
end;

Edited by Beret
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  0
  • Topics Per Day:  0
  • Content Count:  5
  • Reputation:   0
  • Joined:  05/22/12
  • Last Seen:  

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:

Link to comment
Share on other sites

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.

×
×
  • Create New...