Jump to content
  • 0

Help with setarray...


Peopleperson49

Question


  • Group:  Members
  • Topic Count:  218
  • Topics Per Day:  0.05
  • Content Count:  1180
  • Reputation:   141
  • Joined:  01/27/12
  • Last Seen:  

Does setarray support names as shown below? I have tried add the " marks in the setarray and monster command. With or without them the name comes up as a '0' when the monster is spawned. I need a way to get it to work for the script I'm making. For example:

case 1: setarray .@GuardianType[0],"Sniper Guardian",2730,1,5; break;
...
...
monster "pvp_n_1-1",0,0,.@GuardianType[0],.@GuardianType[1],.@GuardianType[2],$KRVictors,"Guardian::OnHWGuardianKill";

Peopleperson49

Link to comment
Share on other sites

9 answers to this question

Recommended Posts


  • Group:  Members
  • Topic Count:  11
  • Topics Per Day:  0.00
  • Content Count:  69
  • Reputation:   10
  • Joined:  05/14/12
  • Last Seen:  

It does in fact supportnames, but you need to have a $ after the variable.

Like this:

case 1: setarray .@GuardianType$[0],"Sniper Guardian","2730","1","5"; break;
...
...
monster "pvp_n_1-1",0,0,.@GuardianType$[0],.@GuardianType$[1],.@GuardianType$[2],$KRVictors,"Guardian::OnHWGuardianKill";

Without the '$' the server will treat the variable as if you're using integers, which in this case won't work because "Sniper Guardian" is a string.

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:  

All variables (including arrays) are either integers or strings. Strings always have a "$" postfix. If you need to store both integer and string values into a single array, set the array as a string, and write all values in quotes (no matter if they're numbers or words). Then, if you need to call an integer value, use the "atoi" command:

*atoi ("<string>")
'atoi' will interpret given string as a decimal number (base 10),

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  218
  • Topics Per Day:  0.05
  • Content Count:  1180
  • Reputation:   141
  • Joined:  01/27/12
  • Last Seen:  

I tired adding the '$' at the end, however as you can probably guess it didn't work. I understand strings and interigers, just wasn't sure what the trick was that I was missing. I know it was possible just had to figure out how. Your wolf Joey looks like something from Neopets, lol. Can I just add the '$' to the setarray and still have it read both intergers and strings, I know other commands support this, but don't want to do trial and error with a working script? Thanks.

Peopleperson49

Edited by peopleperson49
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  5
  • Topics Per Day:  0.00
  • Content Count:  341
  • Reputation:   43
  • Joined:  01/10/12
  • Last Seen:  

You have misplaced it. It should be .@GuardianType$[0].

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  218
  • Topics Per Day:  0.05
  • Content Count:  1180
  • Reputation:   141
  • Joined:  01/27/12
  • Last Seen:  

I understood that, just saying that it was already tried. Sorry to be confusing. Thanks for the reply.

Peopleperson49

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  5
  • Topics Per Day:  0.00
  • Content Count:  341
  • Reputation:   43
  • Joined:  01/10/12
  • Last Seen:  

Let me give you an example of what Euphy said.

case 1: setarray .@GuardianType$[0],"Sniper Guardian","2730","1","5"; break;
...
...
monster "pvp_n_1-1",0,0,.@GuardianType$[0],atoi(.@GuardianType$[1]),atoi(.@GuardianType$[2]),$KRVictors,"Guardian::OnHWGuardianKill";

Edited by Joseph
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  218
  • Topics Per Day:  0.05
  • Content Count:  1180
  • Reputation:   141
  • Joined:  01/27/12
  • Last Seen:  

That makes send because when I tried to use it I got string errors.

Peopleperson49

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  5
  • Topics Per Day:  0.00
  • Content Count:  341
  • Reputation:   43
  • Joined:  01/10/12
  • Last Seen:  

Why not you show us the script with the error attached.

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  218
  • Topics Per Day:  0.05
  • Content Count:  1180
  • Reputation:   141
  • Joined:  01/27/12
  • Last Seen:  

Actually the issue has been resolved thinks to you guys. It works just fine now. The reason I didn't show my script is because it is a full WoE system unlike any other I have every seen! It's actually quite ridiculious! The link to my server is below if you want to download the game and check it out for yourself. Just let me know who you are and I will give you a guided tour. If you read the Server Features page it talks about my War of Emporingium. Anyways, thanks for the assistance!

Peopleperson49

Edited by peopleperson49
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...