View unanswered posts | View active topics It is currently 12 Dec 2017 08:19

Forum rules


- Use common sense and be respectful towards each other at all times, even when disagreeing.
- Do not reveal sensitive game information. Guild secrets, player seconds are examples of things not allowed.



Reply to topic  [ 6 posts ] 
Scripting on Webclient 
Author Message
Apprentice

Joined: 10 Jun 2016 17:08
Posts: 41
I was wrote some scripts on webclient earlier and when I relog, some or all the scripts (or triggers and aliases contain the scripts) didn't saved and reverted back to it's original state - back to old scripts or newly created triggers and aliases are no longer exist although I pressed SAVE button and even <save> in game.

Can someone help me explain how the save mechanic in webclient works? Do I need to wait sometime or do something in order to make new scripts save on database of server?

P.s: A button inside script editor to remove all scripts inside a trigger or alias would be nice since I cannot mass delete scripts on mobile device and webclient system don't have re-order triggers and aliases function... yet!

Thank you!

_________________
Image

Orien are cute (Cool too) kender, if ya disagree with Orien, Orien agree with ya, Orien loves all ^bounce^


28 Nov 2016 06:26
Profile
Apprentice

Joined: 10 Jun 2016 17:08
Posts: 41
Found the issue. You need to go Linkdeath then relog again, if you not Linkdeath then login with new tab and push the other tab out the issue will arise.

Also I'm working on some codes and need some help with syntax:

Code:
switch ((true) || (args[2])) {
  case 'Maivia':
      Loot_Maivia;break;
  case (args[2].indexOf('dark elf') > -1):
      Loot_Darkelf;break;
  default:Loot_General;


If (dark elf case:) I need to use (true) condition for the code to work and in (Maivia case:) I need to use (args[2]) for the code to work hench why my switch have 2 conditions but the problem is it only works in either cases, decided by first condition, not both at the same time. Example: I put (true) before (args[2]) so only (dark elf case:) works and (Maivia case:) will be false and return default value and vice versa... Any solutions for this?

Thank you!

_________________
Image

Orien are cute (Cool too) kender, if ya disagree with Orien, Orien agree with ya, Orien loves all ^bounce^


28 Nov 2016 12:13
Profile
Wizard
User avatar

Joined: 17 Apr 2012 12:09
Posts: 753
Orien wrote:
Found the issue. You need to go Linkdeath then relog again, if you not Linkdeath then login with new tab and push the other tab out the issue will arise.

Also I'm working on some codes and need some help with syntax:

Code:
switch ((true) || (args[2])) {
  case 'Maivia':
      Loot_Maivia;break;
  case (args[2].indexOf('dark elf') > -1):
      Loot_Darkelf;break;
  default:Loot_General;


If (dark elf case:) I need to use (true) condition for the code to work and in (Maivia case:) I need to use (args[2]) for the code to work hench why my switch have 2 conditions but the problem is it only works in either cases, decided by first condition, not both at the same time. Example: I put (true) before (args[2]) so only (dark elf case:) works and (Maivia case:) will be false and return default value and vice versa... Any solutions for this?

Thank you!


You need to change it into an if-else tree. Switch statements don't work like that (case can't be a condition, it has to be a specific value). Also, the switch argument has to be a value, not a condition. Default part of switch will fire if no match is found for any of the cases.

Code:
switch(args[2]) {
    case 'Maivia':
        Loot_Maivia;
        break;
    default:
        if (args[2].indexOf('dark elf') > -1) {
            Loot_Darkelf;
        } else {
            Loot_General;
        }
        break;
}


Edit: Also, true || something will always evaluate to true.

_________________
Time is precious. Waste it wisely.


04 Dec 2016 16:45
Profile
Apprentice

Joined: 10 Jun 2016 17:08
Posts: 41
My current script:

Code:
switch (args[2]) {
  case ’name’:case 'description':loot;break;
  default:variable = true;}

if (variable) {
  switch (true) {
    case (args[2].indexOf('description') > -1):loot;variable = false;break;
    default:loot;}}


Did not thinking of using else-if in default!
Thank you for your answer Zhar!

_________________
Image

Orien are cute (Cool too) kender, if ya disagree with Orien, Orien agree with ya, Orien loves all ^bounce^


04 Dec 2016 18:03
Profile
Wizard
User avatar

Joined: 17 Apr 2012 12:09
Posts: 753
Please break your code into more lines.

Why would you make a switch for true/false? This is not what switch is used for... And it's very non-optimal performance-wise.
And why the hell would you even use a switch if every single case yields the same result? (unless the actual code you posted is not the actual code...)

This does exactly the same thing that your code does:
Code:
switch (args[2]) {
  case ’name’:
  case 'description':
    loot;
    break;
  default:
    variable = !(args[2].indexOf('description') > -1);
    loot;
    break;
}

_________________
Time is precious. Waste it wisely.


04 Dec 2016 21:49
Profile
Apprentice

Joined: 10 Jun 2016 17:08
Posts: 41
Hi Zhar!

It is just an example of my code not the actual one, thanks for your lesson now I know how suck my code is! Already switched back to your version after your first post.

_________________
Image

Orien are cute (Cool too) kender, if ya disagree with Orien, Orien agree with ya, Orien loves all ^bounce^


05 Dec 2016 07:12
Profile
Display posts from previous:  Sort by  
Reply to topic   [ 6 posts ] 

Who is online

Users browsing this forum: No registered users and 2 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB® Forum Software © phpBB Group
Designed by ST Software.