Monday, 2024-05-20, 1:58 AM


Main
Registration
Login
Welcome Guest | RSS  
[ New messages · Members · Forum rules · Search · RSS ]
  • Page 1 of 1
  • 1
Forum moderator: JonNny, Hanky  
Clan NgO Forums » Discussions » Flood Dimension » ??? Text macro ??? (How to use it?)
??? Text macro ???
TheCheeseLoverDate: Sunday, 2009-02-08, 3:29 PM | Message # 1
Sergeant
Group: Users
Messages: 22
Reputation: 0
Status: Offline
Hi!

I am making a spell and I want to make it MUI. So I though I need text macro! But the problem is: I don't know how to use text macro. sad

Can some one help me plz? angel


Yay I have a signature. You suck. :D
 
FireeyeDate: Sunday, 2009-02-08, 7:30 PM | Message # 2
Private
Group: Moderators
Messages: 16
Reputation: 5
Status: Offline
Textmacros aren't required to make a Spell MUI.
They're mainly used to create several functions with a similiar actions without c'n'p + rewritting them.
To make a Spell MUI you need either an Attachment System or using structs + global array.


 
TheCheeseLoverDate: Sunday, 2009-02-08, 10:09 PM | Message # 3
Sergeant
Group: Users
Messages: 22
Reputation: 0
Status: Offline
Me + ( structs + global array) = hein???

Can you teach me structs and globals please? biggrin

THANKS!!

Added (2009-02-08, 10:09 Pm)
---------------------------------------------
HI!

1: When I am making some globals, i can't test my map. ( I have JassNewGenPack. )

2: I imported a system ( with globals ) and I can't test it!


Yay I have a signature. You suck. :D

Message edited by TheCheeseLover - Sunday, 2009-02-08, 8:33 PM
 
FireeyeDate: Monday, 2009-02-09, 0:35 AM | Message # 4
Private
Group: Moderators
Messages: 16
Reputation: 5
Status: Offline
To the struct thing, this is what i most likely do for my spells (don't have JNGP or Jass Craft installed atm, new hard drive):

Code
library WhatEverSpell initializer Init
     struct WhatEverStruct
         //all struct variables
     endstruct

     globals
         //Struct array for storage
         private WhatEverStruct array GlobalStruct
         //Integer for max used Array slot
         private integer struct_init = 0
         //Callback Timer
         private timer CallbackTimer = CreateTimer()
     endglobals

     private function Callback takes nothing returns nothing
         local WhatEverStruct dat
         local integer i = 0
         //Looping through all structs
         loop
             exitwhen i == struct_init
             //Setting global struct to local for preventing OP Limit Hit
             set dat = GlobalStruct[i]
             if DestroyStruct then
                 //Destroying struct if wanted
                 call dat.destroy()
                 //Decreasing max slot and switch structs
                 set struct_init = struct_init - 1
                 set GlobalStruct[i] = GlobalStruct[struct_init]
             else
                 //Checking for next struct
                 set i = i + 1
             endif
         endloop
         if struct_init == 0 then
             call PauseTimer(CallbackTimer)
         endif
     endfunction

     private function OnCast takes nothing returns nothing
         local WhatEverStruct dat = WhatEverStruct.create()
         //Spell Code
         //or whatever
         //Saving struct to global + increasing max slot
         set GlobalStruct[struct_init] = dat
         set struct_init = struct_init + 1
         if struct_init == 1 then
             call TimerStart(CallbackTimer,.03,true,function Callback)
         endif
     endfunction

     private function Init takes nothing returns nothing
         //Whatever init function
     endfunction
endlibrary

So what i most likely do is:
1. Create my struct when the ability is casted
2. Set all variables of the struct
3. Store the current array into the struct array @ slot struct_init
4. Start the callback timer when 1 struct is stored
5. Looping though all array slots on callback to fetch an struct
6. Doing all actions with that struct
7. Checking for destruction of struct, if it should not be destroyed i increase the lcoal integer i for next slot
If it should be destroyed i decrease the globals integer struct_init by 1 and switch the slot of the latest struct with the current destroyed
8. Repeating 6 and 7 with the help of 5
9. If no more structs are saved pausing the timer


 
TheCheeseLoverDate: Monday, 2009-02-09, 0:41 AM | Message # 5
Sergeant
Group: Users
Messages: 22
Reputation: 0
Status: Offline
Thanks!

Can you show me how to import it into a map plz? ( Because when I am making something like that, i cant it test. )


Yay I have a signature. You suck. :D
 
Clan NgO Forums » Discussions » Flood Dimension » ??? Text macro ??? (How to use it?)
  • Page 1 of 1
  • 1
Search:

Clan NgO © 2024Powered by uCoz